forked from qifengzhang007/gooxml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EG_SectPrContents.go
367 lines (358 loc) · 11.4 KB
/
EG_SectPrContents.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
// 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"
"github.com/t-xl/gooxml"
)
type EG_SectPrContents struct {
// Section-Wide Footnote Properties
FootnotePr *CT_FtnProps
// Section-Wide Endnote Properties
EndnotePr *CT_EdnProps
// Section Type
Type *CT_SectType
// Page Size
PgSz *CT_PageSz
// Page Margins
PgMar *CT_PageMar
// Paper Source Information
PaperSrc *CT_PaperSource
// Page Borders
PgBorders *CT_PageBorders
// Line Numbering Settings
LnNumType *CT_LineNumber
// Page Numbering Settings
PgNumType *CT_PageNumber
// Column Definitions
Cols *CT_Columns
// Only Allow Editing of Form Fields
FormProt *CT_OnOff
// Vertical Text Alignment on Page
VAlign *CT_VerticalJc
// Suppress Endnotes In Document
NoEndnote *CT_OnOff
// Different First Page Headers and Footers
TitlePg *CT_OnOff
// Text Flow Direction
TextDirection *CT_TextDirection
// Right to Left Section Layout
Bidi *CT_OnOff
// Gutter on Right Side of Page
RtlGutter *CT_OnOff
// Document Grid
DocGrid *CT_DocGrid
// Reference to Printer Settings Data
PrinterSettings *CT_Rel
}
func NewEG_SectPrContents() *EG_SectPrContents {
ret := &EG_SectPrContents{}
return ret
}
func (m *EG_SectPrContents) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.FootnotePr != nil {
sefootnotePr := xml.StartElement{Name: xml.Name{Local: "w:footnotePr"}}
e.EncodeElement(m.FootnotePr, sefootnotePr)
}
if m.EndnotePr != nil {
seendnotePr := xml.StartElement{Name: xml.Name{Local: "w:endnotePr"}}
e.EncodeElement(m.EndnotePr, seendnotePr)
}
if m.Type != nil {
setype := xml.StartElement{Name: xml.Name{Local: "w:type"}}
e.EncodeElement(m.Type, setype)
}
if m.PgSz != nil {
sepgSz := xml.StartElement{Name: xml.Name{Local: "w:pgSz"}}
e.EncodeElement(m.PgSz, sepgSz)
}
if m.PgMar != nil {
sepgMar := xml.StartElement{Name: xml.Name{Local: "w:pgMar"}}
e.EncodeElement(m.PgMar, sepgMar)
}
if m.PaperSrc != nil {
sepaperSrc := xml.StartElement{Name: xml.Name{Local: "w:paperSrc"}}
e.EncodeElement(m.PaperSrc, sepaperSrc)
}
if m.PgBorders != nil {
sepgBorders := xml.StartElement{Name: xml.Name{Local: "w:pgBorders"}}
e.EncodeElement(m.PgBorders, sepgBorders)
}
if m.LnNumType != nil {
selnNumType := xml.StartElement{Name: xml.Name{Local: "w:lnNumType"}}
e.EncodeElement(m.LnNumType, selnNumType)
}
if m.PgNumType != nil {
sepgNumType := xml.StartElement{Name: xml.Name{Local: "w:pgNumType"}}
e.EncodeElement(m.PgNumType, sepgNumType)
}
if m.Cols != nil {
secols := xml.StartElement{Name: xml.Name{Local: "w:cols"}}
e.EncodeElement(m.Cols, secols)
}
if m.FormProt != nil {
seformProt := xml.StartElement{Name: xml.Name{Local: "w:formProt"}}
e.EncodeElement(m.FormProt, seformProt)
}
if m.VAlign != nil {
sevAlign := xml.StartElement{Name: xml.Name{Local: "w:vAlign"}}
e.EncodeElement(m.VAlign, sevAlign)
}
if m.NoEndnote != nil {
senoEndnote := xml.StartElement{Name: xml.Name{Local: "w:noEndnote"}}
e.EncodeElement(m.NoEndnote, senoEndnote)
}
if m.TitlePg != nil {
setitlePg := xml.StartElement{Name: xml.Name{Local: "w:titlePg"}}
e.EncodeElement(m.TitlePg, setitlePg)
}
if m.TextDirection != nil {
setextDirection := xml.StartElement{Name: xml.Name{Local: "w:textDirection"}}
e.EncodeElement(m.TextDirection, setextDirection)
}
if m.Bidi != nil {
sebidi := xml.StartElement{Name: xml.Name{Local: "w:bidi"}}
e.EncodeElement(m.Bidi, sebidi)
}
if m.RtlGutter != nil {
sertlGutter := xml.StartElement{Name: xml.Name{Local: "w:rtlGutter"}}
e.EncodeElement(m.RtlGutter, sertlGutter)
}
if m.DocGrid != nil {
sedocGrid := xml.StartElement{Name: xml.Name{Local: "w:docGrid"}}
e.EncodeElement(m.DocGrid, sedocGrid)
}
if m.PrinterSettings != nil {
seprinterSettings := xml.StartElement{Name: xml.Name{Local: "w:printerSettings"}}
e.EncodeElement(m.PrinterSettings, seprinterSettings)
}
return nil
}
func (m *EG_SectPrContents) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lEG_SectPrContents:
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: "footnotePr"}:
m.FootnotePr = NewCT_FtnProps()
if err := d.DecodeElement(m.FootnotePr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "endnotePr"}:
m.EndnotePr = NewCT_EdnProps()
if err := d.DecodeElement(m.EndnotePr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "type"}:
m.Type = NewCT_SectType()
if err := d.DecodeElement(m.Type, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgSz"}:
m.PgSz = NewCT_PageSz()
if err := d.DecodeElement(m.PgSz, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgMar"}:
m.PgMar = NewCT_PageMar()
if err := d.DecodeElement(m.PgMar, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "paperSrc"}:
m.PaperSrc = NewCT_PaperSource()
if err := d.DecodeElement(m.PaperSrc, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgBorders"}:
m.PgBorders = NewCT_PageBorders()
if err := d.DecodeElement(m.PgBorders, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "lnNumType"}:
m.LnNumType = NewCT_LineNumber()
if err := d.DecodeElement(m.LnNumType, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgNumType"}:
m.PgNumType = NewCT_PageNumber()
if err := d.DecodeElement(m.PgNumType, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "cols"}:
m.Cols = NewCT_Columns()
if err := d.DecodeElement(m.Cols, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "formProt"}:
m.FormProt = NewCT_OnOff()
if err := d.DecodeElement(m.FormProt, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "vAlign"}:
m.VAlign = NewCT_VerticalJc()
if err := d.DecodeElement(m.VAlign, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "noEndnote"}:
m.NoEndnote = NewCT_OnOff()
if err := d.DecodeElement(m.NoEndnote, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "titlePg"}:
m.TitlePg = NewCT_OnOff()
if err := d.DecodeElement(m.TitlePg, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "textDirection"}:
m.TextDirection = NewCT_TextDirection()
if err := d.DecodeElement(m.TextDirection, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bidi"}:
m.Bidi = NewCT_OnOff()
if err := d.DecodeElement(m.Bidi, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "rtlGutter"}:
m.RtlGutter = NewCT_OnOff()
if err := d.DecodeElement(m.RtlGutter, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "docGrid"}:
m.DocGrid = NewCT_DocGrid()
if err := d.DecodeElement(m.DocGrid, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "printerSettings"}:
m.PrinterSettings = NewCT_Rel()
if err := d.DecodeElement(m.PrinterSettings, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on EG_SectPrContents %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lEG_SectPrContents
case xml.CharData:
}
}
return nil
}
// Validate validates the EG_SectPrContents and its children
func (m *EG_SectPrContents) Validate() error {
return m.ValidateWithPath("EG_SectPrContents")
}
// ValidateWithPath validates the EG_SectPrContents and its children, prefixing error messages with path
func (m *EG_SectPrContents) ValidateWithPath(path string) error {
if m.FootnotePr != nil {
if err := m.FootnotePr.ValidateWithPath(path + "/FootnotePr"); err != nil {
return err
}
}
if m.EndnotePr != nil {
if err := m.EndnotePr.ValidateWithPath(path + "/EndnotePr"); err != nil {
return err
}
}
if m.Type != nil {
if err := m.Type.ValidateWithPath(path + "/Type"); err != nil {
return err
}
}
if m.PgSz != nil {
if err := m.PgSz.ValidateWithPath(path + "/PgSz"); err != nil {
return err
}
}
if m.PgMar != nil {
if err := m.PgMar.ValidateWithPath(path + "/PgMar"); err != nil {
return err
}
}
if m.PaperSrc != nil {
if err := m.PaperSrc.ValidateWithPath(path + "/PaperSrc"); err != nil {
return err
}
}
if m.PgBorders != nil {
if err := m.PgBorders.ValidateWithPath(path + "/PgBorders"); err != nil {
return err
}
}
if m.LnNumType != nil {
if err := m.LnNumType.ValidateWithPath(path + "/LnNumType"); err != nil {
return err
}
}
if m.PgNumType != nil {
if err := m.PgNumType.ValidateWithPath(path + "/PgNumType"); err != nil {
return err
}
}
if m.Cols != nil {
if err := m.Cols.ValidateWithPath(path + "/Cols"); err != nil {
return err
}
}
if m.FormProt != nil {
if err := m.FormProt.ValidateWithPath(path + "/FormProt"); err != nil {
return err
}
}
if m.VAlign != nil {
if err := m.VAlign.ValidateWithPath(path + "/VAlign"); err != nil {
return err
}
}
if m.NoEndnote != nil {
if err := m.NoEndnote.ValidateWithPath(path + "/NoEndnote"); err != nil {
return err
}
}
if m.TitlePg != nil {
if err := m.TitlePg.ValidateWithPath(path + "/TitlePg"); err != nil {
return err
}
}
if m.TextDirection != nil {
if err := m.TextDirection.ValidateWithPath(path + "/TextDirection"); err != nil {
return err
}
}
if m.Bidi != nil {
if err := m.Bidi.ValidateWithPath(path + "/Bidi"); err != nil {
return err
}
}
if m.RtlGutter != nil {
if err := m.RtlGutter.ValidateWithPath(path + "/RtlGutter"); err != nil {
return err
}
}
if m.DocGrid != nil {
if err := m.DocGrid.ValidateWithPath(path + "/DocGrid"); err != nil {
return err
}
}
if m.PrinterSettings != nil {
if err := m.PrinterSettings.ValidateWithPath(path + "/PrinterSettings"); err != nil {
return err
}
}
return nil
}