1 Star 0 Fork 1

窦雪峰 / unioffice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Worksheet.go 11.48 KB
一键复制 编辑 原始数据 按行查看 历史
Todd 提交于 2017-09-29 20:52 . gooxml: add and use a Log function
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting sales@baliance.com.
package sml
import (
"encoding/xml"
"baliance.com/gooxml"
)
type Worksheet struct {
CT_Worksheet
}
func NewWorksheet() *Worksheet {
ret := &Worksheet{}
ret.CT_Worksheet = *NewCT_Worksheet()
return ret
}
func (m *Worksheet) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns"}, Value: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"})
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:ma"}, Value: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"})
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:r"}, Value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"})
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:s"}, Value: "http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"})
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:xdr"}, Value: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"})
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:xml"}, Value: "http://www.w3.org/XML/1998/namespace"})
start.Name.Local = "ma:worksheet"
return m.CT_Worksheet.MarshalXML(e, start)
}
func (m *Worksheet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
m.CT_Worksheet = *NewCT_Worksheet()
lWorksheet:
for {
tok, err := d.Token()
if err != nil {
return err
}
switch el := tok.(type) {
case xml.StartElement:
switch el.Name {
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetPr"}:
m.SheetPr = NewCT_SheetPr()
if err := d.DecodeElement(m.SheetPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "dimension"}:
m.Dimension = NewCT_SheetDimension()
if err := d.DecodeElement(m.Dimension, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetViews"}:
m.SheetViews = NewCT_SheetViews()
if err := d.DecodeElement(m.SheetViews, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetFormatPr"}:
m.SheetFormatPr = NewCT_SheetFormatPr()
if err := d.DecodeElement(m.SheetFormatPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "cols"}:
tmp := NewCT_Cols()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Cols = append(m.Cols, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetData"}:
if err := d.DecodeElement(m.SheetData, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetCalcPr"}:
m.SheetCalcPr = NewCT_SheetCalcPr()
if err := d.DecodeElement(m.SheetCalcPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sheetProtection"}:
m.SheetProtection = NewCT_SheetProtection()
if err := d.DecodeElement(m.SheetProtection, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "protectedRanges"}:
m.ProtectedRanges = NewCT_ProtectedRanges()
if err := d.DecodeElement(m.ProtectedRanges, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "scenarios"}:
m.Scenarios = NewCT_Scenarios()
if err := d.DecodeElement(m.Scenarios, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "autoFilter"}:
m.AutoFilter = NewCT_AutoFilter()
if err := d.DecodeElement(m.AutoFilter, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "sortState"}:
m.SortState = NewCT_SortState()
if err := d.DecodeElement(m.SortState, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "dataConsolidate"}:
m.DataConsolidate = NewCT_DataConsolidate()
if err := d.DecodeElement(m.DataConsolidate, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "customSheetViews"}:
m.CustomSheetViews = NewCT_CustomSheetViews()
if err := d.DecodeElement(m.CustomSheetViews, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "mergeCells"}:
m.MergeCells = NewCT_MergeCells()
if err := d.DecodeElement(m.MergeCells, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "phoneticPr"}:
m.PhoneticPr = NewCT_PhoneticPr()
if err := d.DecodeElement(m.PhoneticPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "conditionalFormatting"}:
tmp := NewCT_ConditionalFormatting()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.ConditionalFormatting = append(m.ConditionalFormatting, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "dataValidations"}:
m.DataValidations = NewCT_DataValidations()
if err := d.DecodeElement(m.DataValidations, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "hyperlinks"}:
m.Hyperlinks = NewCT_Hyperlinks()
if err := d.DecodeElement(m.Hyperlinks, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "printOptions"}:
m.PrintOptions = NewCT_PrintOptions()
if err := d.DecodeElement(m.PrintOptions, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "pageMargins"}:
m.PageMargins = NewCT_PageMargins()
if err := d.DecodeElement(m.PageMargins, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "pageSetup"}:
m.PageSetup = NewCT_PageSetup()
if err := d.DecodeElement(m.PageSetup, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "headerFooter"}:
m.HeaderFooter = NewCT_HeaderFooter()
if err := d.DecodeElement(m.HeaderFooter, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "rowBreaks"}:
m.RowBreaks = NewCT_PageBreak()
if err := d.DecodeElement(m.RowBreaks, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "colBreaks"}:
m.ColBreaks = NewCT_PageBreak()
if err := d.DecodeElement(m.ColBreaks, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "customProperties"}:
m.CustomProperties = NewCT_CustomProperties()
if err := d.DecodeElement(m.CustomProperties, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "cellWatches"}:
m.CellWatches = NewCT_CellWatches()
if err := d.DecodeElement(m.CellWatches, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "ignoredErrors"}:
m.IgnoredErrors = NewCT_IgnoredErrors()
if err := d.DecodeElement(m.IgnoredErrors, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "smartTags"}:
m.SmartTags = NewCT_SmartTags()
if err := d.DecodeElement(m.SmartTags, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "drawing"}:
m.Drawing = NewCT_Drawing()
if err := d.DecodeElement(m.Drawing, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "legacyDrawing"}:
m.LegacyDrawing = NewCT_LegacyDrawing()
if err := d.DecodeElement(m.LegacyDrawing, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "legacyDrawingHF"}:
m.LegacyDrawingHF = NewCT_LegacyDrawing()
if err := d.DecodeElement(m.LegacyDrawingHF, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "drawingHF"}:
m.DrawingHF = NewCT_DrawingHF()
if err := d.DecodeElement(m.DrawingHF, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "picture"}:
m.Picture = NewCT_SheetBackgroundPicture()
if err := d.DecodeElement(m.Picture, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "oleObjects"}:
m.OleObjects = NewCT_OleObjects()
if err := d.DecodeElement(m.OleObjects, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "controls"}:
m.Controls = NewCT_Controls()
if err := d.DecodeElement(m.Controls, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "webPublishItems"}:
m.WebPublishItems = NewCT_WebPublishItems()
if err := d.DecodeElement(m.WebPublishItems, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "tableParts"}:
m.TableParts = NewCT_TableParts()
if err := d.DecodeElement(m.TableParts, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "extLst"}:
m.ExtLst = NewCT_ExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on Worksheet %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lWorksheet
case xml.CharData:
}
}
return nil
}
// Validate validates the Worksheet and its children
func (m *Worksheet) Validate() error {
return m.ValidateWithPath("Worksheet")
}
// ValidateWithPath validates the Worksheet and its children, prefixing error messages with path
func (m *Worksheet) ValidateWithPath(path string) error {
if err := m.CT_Worksheet.ValidateWithPath(path); err != nil {
return err
}
return nil
}
1
https://gitee.com/douxuefeng/unioffice.git
git@gitee.com:douxuefeng/unioffice.git
douxuefeng
unioffice
unioffice
v0.7.1

搜索帮助