summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-02-26 14:21:44 +0800
committerxuri <xuri.me@gmail.com>2019-02-26 14:21:44 +0800
commitf66212da9bab1c39ab791d41881c70ae7ba00c20 (patch)
tree3ec2286ddab3146b122a827a8654804567e9fd51 /sheet.go
parent1aed1d744b12885c4a88c090494175c59208e038 (diff)
Resolve #106, #294 performance optimization for add hyperlink
Diffstat (limited to 'sheet.go')
-rw-r--r--sheet.go37
1 files changed, 31 insertions, 6 deletions
diff --git a/sheet.go b/sheet.go
index efbd466..26d4b4c 100644
--- a/sheet.go
+++ b/sheet.go
@@ -88,18 +88,18 @@ func (f *File) workbookReader() *xlsxWorkbook {
return f.WorkBook
}
-// workbookWriter provides a function to save xl/workbook.xml after serialize
+// workBookWriter provides a function to save xl/workbook.xml after serialize
// structure.
-func (f *File) workbookWriter() {
+func (f *File) workBookWriter() {
if f.WorkBook != nil {
output, _ := xml.Marshal(f.WorkBook)
f.saveFileList("xl/workbook.xml", replaceRelationshipsNameSpaceBytes(output))
}
}
-// worksheetWriter provides a function to save xl/worksheets/sheet%d.xml after
+// workSheetWriter provides a function to save xl/worksheets/sheet%d.xml after
// serialize structure.
-func (f *File) worksheetWriter() {
+func (f *File) workSheetWriter() {
for path, sheet := range f.Sheet {
if sheet != nil {
for k, v := range sheet.SheetData.Row {
@@ -172,9 +172,9 @@ func (f *File) workbookRelsReader() *xlsxWorkbookRels {
return f.WorkBookRels
}
-// workbookRelsWriter provides a function to save xl/_rels/workbook.xml.rels after
+// workBookRelsWriter provides a function to save xl/_rels/workbook.xml.rels after
// serialize structure.
-func (f *File) workbookRelsWriter() {
+func (f *File) workBookRelsWriter() {
if f.WorkBookRels != nil {
output, _ := xml.Marshal(f.WorkBookRels)
f.saveFileList("xl/_rels/workbook.xml.rels", output)
@@ -1003,3 +1003,28 @@ func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error {
}
return nil
}
+
+// workSheetRelsReader provides a function to get the pointer to the structure
+// after deserialization of xl/worksheets/_rels/sheet%d.xml.rels.
+func (f *File) workSheetRelsReader(path string) *xlsxWorkbookRels {
+ if f.WorkSheetRels[path] == nil {
+ _, ok := f.XLSX[path]
+ if ok {
+ c := xlsxWorkbookRels{}
+ _ = xml.Unmarshal(namespaceStrictToTransitional(f.readXML(path)), &c)
+ f.WorkSheetRels[path] = &c
+ }
+ }
+ return f.WorkSheetRels[path]
+}
+
+// workSheetRelsWriter provides a function to save
+// xl/worksheets/_rels/sheet%d.xml.rels after serialize structure.
+func (f *File) workSheetRelsWriter() {
+ for path, r := range f.WorkSheetRels {
+ if r != nil {
+ v, _ := xml.Marshal(r)
+ f.saveFileList(path, v)
+ }
+ }
+}