go_docx

package module
v0.0.0-...-2e95504 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: MIT Imports: 8 Imported by: 0

README

Go-Docx Library

a library has been created for working with docx files, parsing them and changing data in them

Future:

  • parse docsProps
  • parse rels/
  • parse word/
  • work with file structure with all dependencies
  • add CI
  • ok marshal equal to original files

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileHasNotBeenReadYet = fmt.Errorf("error the file has not been read yet")

Functions

This section is empty.

Types

type Body

type Body struct {
	XMLName    xml.Name    `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main body"`
	Paragraphs []Paragraph `xml:"p"`
	Section    Section     `xml:"sectPr"`
}

type Cols

type Cols struct {
	Space int `xml:"space,attr"`
}

type DOCX

type DOCX struct {
	// contains filtered or unexported fields
}

func New

func New() *DOCX

func (*DOCX) Close

func (d *DOCX) Close() error

func (*DOCX) ExportDOCXFile

func (d *DOCX) ExportDOCXFile(to string) error

func (*DOCX) FromFile

func (d *DOCX) FromFile(path string) (*DOCX, error)

func (*DOCX) FromReader

func (d *DOCX) FromReader(reader io.Reader) (*DOCX, error)

func (*DOCX) GetContentTypeXML

func (d *DOCX) GetContentTypeXML() (XMLContentType, error)

func (*DOCX) GetMediaFilesName

func (d *DOCX) GetMediaFilesName() ([]string, error)

func (*DOCX) GetOrientation

func (d *DOCX) GetOrientation() (Orientation, error)

func (*DOCX) GetWordDocumentXML

func (d *DOCX) GetWordDocumentXML() (XMLDocument, error)

type DocGrid

type DocGrid struct {
	LinePitch int `xml:"linePitch,attr"`
}

type Orientation

type Orientation int
const (
	OrientationVertical Orientation = iota
	OrientationHorizontal
)

type Paragraph

type Paragraph struct {
	Text string `xml:"r>t"`
}

type PgMar

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

type PgSz

type PgSz struct {
	Width  int `xml:"w,attr"`
	Height int `xml:"h,attr"`
}

type Section

type Section struct {
	PgSz    PgSz    `xml:"pgSz"`
	PgMar   PgMar   `xml:"pgMar"`
	Cols    Cols    `xml:"cols"`
	DocGrid DocGrid `xml:"docGrid"`
}

type WordStructure

type WordStructure struct {
	// contains filtered or unexported fields
}

type XMLContentType

type XMLContentType struct {
	XMLName xml.Name `xml:"Types"`

	Overrides []XMLContentTypeOverride `xml:"Override"`
	Defaults  []XMLContentTypeDefault  `xml:"Default"`
}

type XMLContentTypeDefault

type XMLContentTypeDefault struct {
	Extension   string `xml:"Extension,attr"`
	ContentType string `xml:"ContentType,attr"`
}

type XMLContentTypeOverride

type XMLContentTypeOverride struct {
	PartName    string `xml:"PartName,attr"`
	ContentType string `xml:"ContentType,attr"`
}

type XMLDocument

type XMLDocument struct {
	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main document"`
	Body    Body     `xml:"body"`
}

Jump to

Keyboard shortcuts

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