oxml

package
v0.0.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	XMLName  xml.Name         `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main body"`
	Children []*DocumentChild `xml:",any"`

	SectPr *CTSectPr
}

func NewBody

func NewBody() *Body

func (*Body) MarshalXML

func (b *Body) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Body) UnmarshalXML

func (body *Body) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type CTSectPr

type CTSectPr struct {
	Type      *SectionType    `xml:"type,omitempty"`
	PgSz      *PageSize       `xml:"pgSz,omitempty"`
	PgMar     *PageMargins    `xml:"pgMar,omitempty"`
	PgNumType *PageNumbering  `xml:"pgNumType,omitempty"`
	FormProt  *FormProtection `xml:"formProt,omitempty"`
	TextDir   *TextDirection  `xml:"textDirection,omitempty"`
	DocGrid   *DocGrid        `xml:"docGrid,omitempty"` // Add DocGrid field

}

func (*CTSectPr) MarshalXML

func (sectPr *CTSectPr) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type CoreProperties

type CoreProperties struct {
	Category       string
	ContentStatus  string
	Created        string
	Creator        string
	Description    string
	Identifier     string
	Keywords       string
	LastModifiedBy string
	Modified       string
	Revision       string
	Subject        string
	Title          string
	Language       string
	Version        string
}

func LoadDocProps

func LoadDocProps(fileBytes []byte) (cp *CoreProperties, err error)

type DocGrid

type DocGrid struct {
	Type      string `xml:"type,attr,omitempty"`
	LinePitch int    `xml:"linePitch,attr,omitempty"`
	CharSpace int    `xml:"charSpace,attr,omitempty"`
}

func (*DocGrid) MarshalXML

func (docGrid *DocGrid) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Document

type Document struct {
	Body *Body
	// contains filtered or unexported fields
}

func LoadDocXml

func LoadDocXml(fileName string, fileBytes []byte) (*Document, error)

func (*Document) MarshalXML

func (doc *Document) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Document) UnmarshalXML

func (doc *Document) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type DocumentChild

type DocumentChild struct {
	Para  *elements.Paragraph
	Table *Table
}

type ExtendedProperties

type ExtendedProperties struct {
	Application       string
	ScaleCrop         bool
	DocSecurity       int
	Company           string
	LinksUpToDate     bool
	HyperlinksChanged bool
	AppVersion        string
}

type FormProtection

type FormProtection struct {
	Val string `xml:"val,attr,omitempty"`
}

func (*FormProtection) MarshalXML

func (formProt *FormProtection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type HeadingPairs

type HeadingPairs struct {
	Vector Vector `xml:"HeadingPairs"`
}

type PageMargins

type PageMargins struct {
	Left   int `xml:"left,attr,omitempty"`
	Right  int `xml:"right,attr,omitempty"`
	Gutter int `xml:"gutter,attr,omitempty"`
	Header int `xml:"header,attr,omitempty"`
	Top    int `xml:"top,attr,omitempty"`
	Footer int `xml:"footer,attr,omitempty"`
	Bottom int `xml:"bottom,attr,omitempty"` // Add Bottom attribute
}

func (*PageMargins) MarshalXML

func (pgMar *PageMargins) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PageNumbering

type PageNumbering struct {
	Fmt string `xml:"fmt,attr,omitempty"`
}

func (*PageNumbering) MarshalXML

func (pgNumType *PageNumbering) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PageSize

type PageSize struct {
	W int `xml:"w,attr,omitempty"`
	H int `xml:"h,attr,omitempty"`
}

func (*PageSize) MarshalXML

func (pgSz *PageSize) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Relationship

type Relationship struct {
	XMLName    xml.Name `xml:"Relationship"`
	ID         string   `xml:"Id,attr"`
	Type       string   `xml:"Type,attr"`
	Target     string   `xml:"Target,attr"`
	TargetMode string   `xml:"TargetMode,attr,omitempty"`
}

type Relationships

type Relationships struct {
	RelativePath  string          `xml:"-"`
	XMLName       xml.Name        `xml:"Relationships"`
	Xmlns         string          `xml:"xmlns,attr"`
	Relationships []*Relationship `xml:"Relationship"`
}

type RootDoc

type RootDoc struct {
	Path     string
	FileMap  sync.Map
	Document *Document
	RootRels Relationships
	DocRels  Relationships
	// contains filtered or unexported fields
}

func NewRootDoc

func NewRootDoc() *RootDoc

func (*RootDoc) AddEmptyParagraph

func (rd *RootDoc) AddEmptyParagraph() *elements.Paragraph

func (*RootDoc) AddHeading

func (rd *RootDoc) AddHeading(text string, level uint) (*elements.Paragraph, error)

Return a heading paragraph newly added to the end of the document. The heading paragraph will contain text and have its paragraph style determined by level. If level is 0, the style is set to Title. The style is set to Heading {level}. if level is outside the range 0-9, error will be returned

func (*RootDoc) AddParagraph

func (rd *RootDoc) AddParagraph(text string) *elements.Paragraph

func (*RootDoc) Close

func (rd *RootDoc) Close() error

func (*RootDoc) Save

func (rd *RootDoc) Save() error

func (*RootDoc) SaveTo

func (rd *RootDoc) SaveTo(fileName string) error

func (*RootDoc) Write

func (rd *RootDoc) Write(w io.Writer) error

func (*RootDoc) WriteTo

func (rd *RootDoc) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo to write the file.

type SectionType

type SectionType struct {
	Val string `xml:"val,attr,omitempty"`
}

func (*SectionType) MarshalXML

func (st *SectionType) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Table

type Table struct {
}

type TextDirection

type TextDirection struct {
	Val string `xml:"val,attr,omitempty"`
}

func (*TextDirection) MarshalXML

func (textDir *TextDirection) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TitlesOfParts

type TitlesOfParts struct {
	Vector Vector `xml:"TitlesOfParts"`
}

type Variant

type Variant struct {
	LPStr string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes lpstr,omitempty"`
	I4    int    `xml:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes i4,omitempty"`
}

type Vector

type Vector struct {
	Size     int       `xml:"size,attr"`
	BaseType string    `xml:"baseType,attr"`
	Variant  []Variant `xml:"variant,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL