Ver código fonte

Merge pull request #847 from qwaszx102938/master

fix the bug that  there was no count attribute in sharedStrings file, fix the bug that setting OutlineSummaryBelow false
xuri 4 anos atrás
pai
commit
056dc8454e
2 arquivos alterados com 6 adições e 3 exclusões
  1. 3 0
      rows.go
  2. 3 3
      xmlWorksheet.go

+ 3 - 0
rows.go

@@ -322,6 +322,9 @@ func (f *File) sharedStringsReader() *xlsxSST {
 			Decode(&sharedStrings); err != nil && err != io.EOF {
 			Decode(&sharedStrings); err != nil && err != io.EOF {
 			log.Printf("xml decode error: %s", err)
 			log.Printf("xml decode error: %s", err)
 		}
 		}
+		if sharedStrings.Count == 0 {
+			sharedStrings.Count = len(sharedStrings.SI)
+		}
 		if sharedStrings.UniqueCount == 0 {
 		if sharedStrings.UniqueCount == 0 {
 			sharedStrings.UniqueCount = sharedStrings.Count
 			sharedStrings.UniqueCount = sharedStrings.Count
 		}
 		}

+ 3 - 3
xmlWorksheet.go

@@ -248,9 +248,9 @@ type xlsxSheetPr struct {
 // adjust the direction of grouper controls.
 // adjust the direction of grouper controls.
 type xlsxOutlinePr struct {
 type xlsxOutlinePr struct {
 	ApplyStyles        *bool `xml:"applyStyles,attr"`
 	ApplyStyles        *bool `xml:"applyStyles,attr"`
-	SummaryBelow       bool  `xml:"summaryBelow,attr,omitempty"`
-	SummaryRight       bool  `xml:"summaryRight,attr,omitempty"`
-	ShowOutlineSymbols bool  `xml:"showOutlineSymbols,attr,omitempty"`
+	SummaryBelow       bool  `xml:"summaryBelow,attr"`
+	SummaryRight       bool  `xml:"summaryRight,attr"`
+	ShowOutlineSymbols bool  `xml:"showOutlineSymbols,attr"`
 }
 }
 
 
 // xlsxPageSetUpPr expresses page setup properties of the worksheet.
 // xlsxPageSetUpPr expresses page setup properties of the worksheet.