mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-05 07:40:24 +08:00
feat: A3PageSize (#22)
* feat: A3PageSize * feat: A3PageSize2 * feat: A3PageSize3 * feat: A3PageSize3 * feat: A3PageSize4 * Update structsect.go --------- Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
29
theme.go
29
theme.go
@@ -20,7 +20,10 @@
|
||||
|
||||
package docx
|
||||
|
||||
import "io/fs"
|
||||
import (
|
||||
"encoding/xml"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
// UseTemplate will replace template files
|
||||
func (f *Docx) UseTemplate(template string, tmpfslst []string, tmplfs fs.FS) *Docx {
|
||||
@@ -34,3 +37,27 @@ func (f *Docx) UseTemplate(template string, tmpfslst []string, tmplfs fs.FS) *Do
|
||||
func (f *Docx) WithDefaultTheme() *Docx {
|
||||
return f.UseTemplate("default", DefaultTemplateFilesList, TemplateXMLFS)
|
||||
}
|
||||
|
||||
// WithA3Page use A3 PageSize
|
||||
func (f *Docx) WithA3Page() *Docx {
|
||||
sectpr := &SectPr{
|
||||
PgSz: &PgSz{
|
||||
W: xml.Attr{Name: xml.Name{Local: "w:w"}, Value: "16838"},
|
||||
H: xml.Attr{Name: xml.Name{Local: "w:h"}, Value: "23811"},
|
||||
},
|
||||
}
|
||||
f.Document.Body.Items = append(f.Document.Body.Items, sectpr)
|
||||
return f
|
||||
}
|
||||
|
||||
// WithA4Page use A4 PageSize
|
||||
func (f *Docx) WithA4Page() *Docx {
|
||||
sectpr := &SectPr{
|
||||
PgSz: &PgSz{
|
||||
W: xml.Attr{Name: xml.Name{Local: "w:w"}, Value: "11906"},
|
||||
H: xml.Attr{Name: xml.Name{Local: "w:h"}, Value: "16838"},
|
||||
},
|
||||
}
|
||||
f.Document.Body.Items = append(f.Document.Body.Items, sectpr)
|
||||
return f
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user