Browse Source

Fix non-visual canvas properties ID calculator.

Ri Xu 8 years ago
parent
commit
7c3f91ada4
3 changed files with 6 additions and 7 deletions
  1. 4 3
      chart.go
  2. 1 2
      picture.go
  3. 1 2
      shape.go

+ 4 - 3
chart.go

@@ -806,7 +806,8 @@ func (f *File) drawPlotAreaTxPr() *cTxPr {
 // problem that the label structure is changed after serialization and
 // deserialization, two different structures: decodeWsDr and encodeWsDr are
 // defined.
-func (f *File) drawingParser(drawingXML string, cNvPrID int, content *xlsxWsDr) {
+func (f *File) drawingParser(drawingXML string, content *xlsxWsDr) int {
+	cNvPrID := 1
 	_, ok := f.XLSX[drawingXML]
 	if ok { // Append Model
 		decodeWsDr := decodeWsDr{}
@@ -825,6 +826,7 @@ func (f *File) drawingParser(drawingXML string, cNvPrID int, content *xlsxWsDr)
 			})
 		}
 	}
+	return cNvPrID
 }
 
 // addDrawingChart provides function to add chart graphic frame by given sheet,
@@ -841,8 +843,7 @@ func (f *File) addDrawingChart(sheet, drawingXML, cell string, width, height, rI
 	content := xlsxWsDr{}
 	content.A = NameSpaceDrawingML
 	content.Xdr = NameSpaceDrawingMLSpreadSheet
-	cNvPrID := 1
-	f.drawingParser(drawingXML, cNvPrID, &content)
+	cNvPrID := f.drawingParser(drawingXML, &content)
 	twoCellAnchor := xdrCellAnchor{}
 	twoCellAnchor.EditAs = "oneCell"
 	from := xlsxFrom{}

+ 1 - 2
picture.go

@@ -181,8 +181,7 @@ func (f *File) addDrawingPicture(sheet, drawingXML, cell, file string, width, he
 	content := xlsxWsDr{}
 	content.A = NameSpaceDrawingML
 	content.Xdr = NameSpaceDrawingMLSpreadSheet
-	cNvPrID := 1
-	f.drawingParser(drawingXML, cNvPrID, &content)
+	cNvPrID := f.drawingParser(drawingXML, &content)
 	twoCellAnchor := xdrCellAnchor{}
 	twoCellAnchor.EditAs = "oneCell"
 	from := xlsxFrom{}

+ 1 - 2
shape.go

@@ -297,8 +297,7 @@ func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *format
 	content := xlsxWsDr{}
 	content.A = NameSpaceDrawingML
 	content.Xdr = NameSpaceDrawingMLSpreadSheet
-	cNvPrID := 1
-	f.drawingParser(drawingXML, cNvPrID, &content)
+	cNvPrID := f.drawingParser(drawingXML, &content)
 	twoCellAnchor := xdrCellAnchor{}
 	twoCellAnchor.EditAs = "oneCell"
 	from := xlsxFrom{}