diff options
Diffstat (limited to 'excelize.go')
-rw-r--r-- | excelize.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/excelize.go b/excelize.go index 0b1e410..31fa370 100644 --- a/excelize.go +++ b/excelize.go @@ -23,7 +23,7 @@ type File struct { Styles *xlsxStyleSheet WorkBook *xlsxWorkbook WorkBookRels *xlsxWorkbookRels - XLSX map[string]string + XLSX map[string][]byte } // OpenFile take the name of an XLSX file and returns a populated XLSX file @@ -88,7 +88,7 @@ func (f *File) workSheetReader(sheet string) *xlsxWorksheet { } if f.Sheet[name] == nil { var xlsx xlsxWorksheet - xml.Unmarshal([]byte(f.readXML(name)), &xlsx) + xml.Unmarshal(f.readXML(name), &xlsx) if f.checked == nil { f.checked = make(map[string]bool) } @@ -141,6 +141,13 @@ func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string { return workbookMarshal } +func replaceWorkSheetsRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte { + var oldXmlns = []byte(`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`) + var newXmlns = []byte(`<worksheet xr:uid="{00000000-0001-0000-0000-000000000000}" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" mc:Ignorable="x14ac xr xr2 xr3" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`) + workbookMarshal = bytes.Replace(workbookMarshal, oldXmlns, newXmlns, -1) + return workbookMarshal +} + // UpdateLinkedValue fix linked values within a spreadsheet are not updating in // Office Excel 2007 and 2010. This function will be remove value tag when met a // cell have a linked value. Reference |