diff options
| -rw-r--r-- | excelize.go | 2 | ||||
| -rw-r--r-- | sheet.go | 2 | ||||
| -rw-r--r-- | xmlWorksheet.go | 18 | 
3 files changed, 20 insertions, 2 deletions
| diff --git a/excelize.go b/excelize.go index ba6445f..c59ec8c 100644 --- a/excelize.go +++ b/excelize.go @@ -192,7 +192,7 @@ func (f *File) addRels(relPath, relType, target, targetMode string) int {  // Office Excel 2007.  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:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" mc:Ignorable="x14ac xr xr2 xr3 xr6 xr10 x15" 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">`) +	var newXmlns = []byte(`<worksheet xr:uid="{00000000-0001-0000-0000-000000000000}" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" mc:Ignorable="x14ac xdr xr xr2 xr3 xr6 xr10 x15" 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  } @@ -207,7 +207,7 @@ func replaceRelationshipsBytes(content []byte) []byte {  // a horrible hack to fix that after the XML marshalling is completed.  func replaceRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte {  	oldXmlns := []byte(`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`) -	newXmlns := []byte(`<workbook xr:uid="{00000000-0001-0000-0000-000000000000}" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" mc:Ignorable="x14ac xr xr2 xr3 xr6 xr10 x15" 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">`) +	newXmlns := []byte(`<workbook xr:uid="{00000000-0001-0000-0000-000000000000}" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" mc:Ignorable="x14ac xdr xr xr2 xr3 xr6 xr10 x15" 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">`)  	return bytes.Replace(workbookMarshal, oldXmlns, newXmlns, -1)  } diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 8408cfa..cb854cd 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -22,8 +22,13 @@ type xlsxWorksheet struct {  	SheetFormatPr         *xlsxSheetFormatPr           `xml:"sheetFormatPr"`  	Cols                  *xlsxCols                    `xml:"cols,omitempty"`  	SheetData             xlsxSheetData                `xml:"sheetData"` +	SheetCalcPr           *xlsxInnerXML                `xml:"sheetCalcPr"`  	SheetProtection       *xlsxSheetProtection         `xml:"sheetProtection"` +	ProtectedRanges       *xlsxInnerXML                `xml:"protectedRanges"` +	Scenarios             *xlsxInnerXML                `xml:"scenarios"`  	AutoFilter            *xlsxAutoFilter              `xml:"autoFilter"` +	SortState             *xlsxInnerXML                `xml:"sortState"` +	DataConsolidate       *xlsxInnerXML                `xml:"dataConsolidate"`  	CustomSheetViews      *xlsxCustomSheetViews        `xml:"customSheetViews"`  	MergeCells            *xlsxMergeCells              `xml:"mergeCells"`  	PhoneticPr            *xlsxPhoneticPr              `xml:"phoneticPr"` @@ -36,9 +41,18 @@ type xlsxWorksheet struct {  	HeaderFooter          *xlsxHeaderFooter            `xml:"headerFooter"`  	RowBreaks             *xlsxBreaks                  `xml:"rowBreaks"`  	ColBreaks             *xlsxBreaks                  `xml:"colBreaks"` +	CustomProperties      *xlsxInnerXML                `xml:"customProperties"` +	CellWatches           *xlsxInnerXML                `xml:"cellWatches"` +	IgnoredErrors         *xlsxInnerXML                `xml:"ignoredErrors"` +	SmartTags             *xlsxInnerXML                `xml:"smartTags"`  	Drawing               *xlsxDrawing                 `xml:"drawing"`  	LegacyDrawing         *xlsxLegacyDrawing           `xml:"legacyDrawing"` +	LegacyDrawingHF       *xlsxInnerXML                `xml:"legacyDrawingHF"` +	DrawingHF             *xlsxDrawingHF               `xml:"drawingHF"`  	Picture               *xlsxPicture                 `xml:"picture"` +	OleObjects            *xlsxInnerXML                `xml:"oleObjects"` +	Controls              *xlsxInnerXML                `xml:"controls"` +	WebPublishItems       *xlsxInnerXML                `xml:"webPublishItems"`  	TableParts            *xlsxTableParts              `xml:"tableParts"`  	ExtLst                *xlsxExtLst                  `xml:"extLst"`  } @@ -631,6 +645,10 @@ type xlsxLegacyDrawing struct {  	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`  } +type xlsxInnerXML struct { +	Content string `xml:",innerxml"` +} +  // xlsxWorksheetExt directly maps the ext element in the worksheet.  type xlsxWorksheetExt struct {  	XMLName xml.Name `xml:"ext"` | 
