Skip to content

Commit 96b3e1e

Browse files
committed
Bugfix: corrupted xlsx after write operation, relate issue #152.
Signed-off-by: Ri Xu <[email protected]>
1 parent a4ffb4f commit 96b3e1e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

excelize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func checkSheet(xlsx *xlsxWorksheet) {
135135
// Office Excel 2007.
136136
func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
137137
oldXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
138-
newXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">`
138+
newXmlns := `<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">`
139139
workbookMarshal = strings.Replace(workbookMarshal, oldXmlns, newXmlns, -1)
140140
return workbookMarshal
141141
}

xmlWorksheet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ type xlsxSheetProtection struct {
357357
// properties specify how to display that phonetic run.
358358
type xlsxPhoneticPr struct {
359359
Alignment string `xml:"alignment,attr,omitempty"`
360-
FontID int `xml:"fontId,attr,omitempty"`
360+
FontID *int `xml:"fontId,attr"`
361361
Type string `xml:"type,attr,omitempty"`
362362
}
363363

0 commit comments

Comments
 (0)