mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +08:00
96 lines
2.6 KiB
Go
96 lines
2.6 KiB
Go
// 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 dml
|
|
|
|
import (
|
|
"encoding/xml"
|
|
|
|
"baliance.com/gooxml"
|
|
)
|
|
|
|
type CT_TablePartStyle struct {
|
|
TcTxStyle *CT_TableStyleTextStyle
|
|
TcStyle *CT_TableStyleCellStyle
|
|
}
|
|
|
|
func NewCT_TablePartStyle() *CT_TablePartStyle {
|
|
ret := &CT_TablePartStyle{}
|
|
return ret
|
|
}
|
|
|
|
func (m *CT_TablePartStyle) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
|
e.EncodeToken(start)
|
|
if m.TcTxStyle != nil {
|
|
setcTxStyle := xml.StartElement{Name: xml.Name{Local: "a:tcTxStyle"}}
|
|
e.EncodeElement(m.TcTxStyle, setcTxStyle)
|
|
}
|
|
if m.TcStyle != nil {
|
|
setcStyle := xml.StartElement{Name: xml.Name{Local: "a:tcStyle"}}
|
|
e.EncodeElement(m.TcStyle, setcStyle)
|
|
}
|
|
e.EncodeToken(xml.EndElement{Name: start.Name})
|
|
return nil
|
|
}
|
|
|
|
func (m *CT_TablePartStyle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
|
// initialize to default
|
|
lCT_TablePartStyle:
|
|
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/drawingml/2006/main", Local: "tcTxStyle"}:
|
|
m.TcTxStyle = NewCT_TableStyleTextStyle()
|
|
if err := d.DecodeElement(m.TcTxStyle, &el); err != nil {
|
|
return err
|
|
}
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "tcStyle"}:
|
|
m.TcStyle = NewCT_TableStyleCellStyle()
|
|
if err := d.DecodeElement(m.TcStyle, &el); err != nil {
|
|
return err
|
|
}
|
|
default:
|
|
gooxml.Log("skipping unsupported element on CT_TablePartStyle %v", el.Name)
|
|
if err := d.Skip(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
case xml.EndElement:
|
|
break lCT_TablePartStyle
|
|
case xml.CharData:
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Validate validates the CT_TablePartStyle and its children
|
|
func (m *CT_TablePartStyle) Validate() error {
|
|
return m.ValidateWithPath("CT_TablePartStyle")
|
|
}
|
|
|
|
// ValidateWithPath validates the CT_TablePartStyle and its children, prefixing error messages with path
|
|
func (m *CT_TablePartStyle) ValidateWithPath(path string) error {
|
|
if m.TcTxStyle != nil {
|
|
if err := m.TcTxStyle.ValidateWithPath(path + "/TcTxStyle"); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if m.TcStyle != nil {
|
|
if err := m.TcStyle.ValidateWithPath(path + "/TcStyle"); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|