summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-12-27 23:34:14 +0800
committerxuri <xuri.me@gmail.com>2021-12-27 23:49:28 +0800
commit89b85934f60ba0012f3de6da03eb12959e4b4b72 (patch)
tree3d913c2bdabf06b79b7c2f223cfe26b64aacd8cc /sheet.go
parent6b1e592cbc7b1412da5f6d0badeaf1083117c762 (diff)
This closes #1096, memory usage optimization and another 4 changes
- Unzip shared string table to system temporary file when large inner XML, reduce memory usage about 70% - Remove unnecessary exported variable `XMLHeader`, we can using `encoding/xml` package's `xml.Header` instead of it - Using constant instead of inline text for default XML path - Rename exported option field `WorksheetUnzipMemLimit` to `UnzipXMLSizeLimit` - Unit test and documentation updated
Diffstat (limited to 'sheet.go')
-rw-r--r--sheet.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/sheet.go b/sheet.go
index 99ae1a2..17f6693 100644
--- a/sheet.go
+++ b/sheet.go
@@ -76,7 +76,7 @@ func (f *File) contentTypesReader() *xlsxTypes {
f.ContentTypes = new(xlsxTypes)
f.ContentTypes.Lock()
defer f.ContentTypes.Unlock()
- if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML("[Content_Types].xml")))).
+ if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(defaultXMLPathContentTypes)))).
Decode(f.ContentTypes); err != nil && err != io.EOF {
log.Printf("xml decode error: %s", err)
}
@@ -89,7 +89,7 @@ func (f *File) contentTypesReader() *xlsxTypes {
func (f *File) contentTypesWriter() {
if f.ContentTypes != nil {
output, _ := xml.Marshal(f.ContentTypes)
- f.saveFileList("[Content_Types].xml", output)
+ f.saveFileList(defaultXMLPathContentTypes, output)
}
}
@@ -304,7 +304,7 @@ func (f *File) relsWriter() {
// setAppXML update docProps/app.xml file of XML.
func (f *File) setAppXML() {
- f.saveFileList("docProps/app.xml", []byte(templateDocpropsApp))
+ f.saveFileList(dafaultXMLPathDocPropsApp, []byte(templateDocpropsApp))
}
// replaceRelationshipsBytes; Some tools that read spreadsheet files have very