1 Star 0 Fork 1

青大叔/gooxml

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
CT_NumPicBullet.go 2.98 KB
Copy Edit Raw Blame History
qwj authored 2021-09-03 14:09 +08:00 . 修改包名
// 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 wml
import (
"encoding/xml"
"fmt"
"strconv"
"gitee.com/jiewen/gooxml"
)
type CT_NumPicBullet struct {
// Picture Numbering Symbol ID
NumPicBulletIdAttr int64
// Picture Numbering Symbol Properties
Pict *CT_Picture
Drawing *CT_Drawing
}
func NewCT_NumPicBullet() *CT_NumPicBullet {
ret := &CT_NumPicBullet{}
return ret
}
func (m *CT_NumPicBullet) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "w:numPicBulletId"},
Value: fmt.Sprintf("%v", m.NumPicBulletIdAttr)})
e.EncodeToken(start)
if m.Pict != nil {
sepict := xml.StartElement{Name: xml.Name{Local: "w:pict"}}
e.EncodeElement(m.Pict, sepict)
}
if m.Drawing != nil {
sedrawing := xml.StartElement{Name: xml.Name{Local: "w:drawing"}}
e.EncodeElement(m.Drawing, sedrawing)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_NumPicBullet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Local == "numPicBulletId" {
parsed, err := strconv.ParseInt(attr.Value, 10, 64)
if err != nil {
return err
}
m.NumPicBulletIdAttr = parsed
continue
}
}
lCT_NumPicBullet:
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/wordprocessingml/2006/main", Local: "pict"}:
m.Pict = NewCT_Picture()
if err := d.DecodeElement(m.Pict, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "drawing"}:
m.Drawing = NewCT_Drawing()
if err := d.DecodeElement(m.Drawing, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on CT_NumPicBullet %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_NumPicBullet
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_NumPicBullet and its children
func (m *CT_NumPicBullet) Validate() error {
return m.ValidateWithPath("CT_NumPicBullet")
}
// ValidateWithPath validates the CT_NumPicBullet and its children, prefixing error messages with path
func (m *CT_NumPicBullet) ValidateWithPath(path string) error {
if m.Pict != nil {
if err := m.Pict.ValidateWithPath(path + "/Pict"); err != nil {
return err
}
}
if m.Drawing != nil {
if err := m.Drawing.ValidateWithPath(path + "/Drawing"); err != nil {
return err
}
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiewen/gooxml.git
git@gitee.com:jiewen/gooxml.git
jiewen
gooxml
gooxml
c517a803bade

Search