Documentation ¶
Index ¶
- type Docx
- func (d *Docx) GetCustomXML() map[string]string
- func (d *Docx) GetCustomXMLByRootNs(rootNS string) (customXmlmap map[string]string, err error)
- func (d *Docx) RemoveCustomXML(path string) (err error)
- func (d *Docx) RemoveElementsFromMainDocument(elementXpath string) (err error)
- func (d *Docx) Replace(oldString string, newString string, num int) (err error)
- func (d *Docx) ReplaceFooter(oldString string, newString string) (err error)
- func (d *Docx) ReplaceHeader(oldString string, newString string) (err error)
- func (d *Docx) ReplaceLink(oldString string, newString string, num int) (err error)
- func (d *Docx) ReplaceRaw(oldString string, newString string, num int)
- func (d *Docx) Write(ioWriter io.Writer) (err error)
- func (d *Docx) WriteToFile(path string) (err error)
- type ExistingRelationshipsError
- type NoCustomXmlPartError
- type NoElementsFoundAtXPath
- type ReplaceDocx
- type ZipData
- type ZipFile
- type ZipInMemory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docx ¶
type Docx struct {
// contains filtered or unexported fields
}
func (*Docx) GetCustomXML ¶
GetCustomXML returns a map with key values being a path to a customXML file and the map value the respective content as a string. Result is nil if no customXML parts were retrieved
func (*Docx) GetCustomXMLByRootNs ¶
GetCustomXMLByRootNs returns a map with key values being a path to a customXML Part file in the OPC and the map value the respective content as a string. The map will only contain customXML Parts which XML root namespace matches the given parameter one. Result is nil if no customXML parts were retrieved
func (*Docx) RemoveCustomXML ¶
RemoveCustomXML tries to remove a customXml Part from the OPC container. The Part to be removed is designated by the path to 'itemX.xml' file under the 'customXml' directory in the OPC. e.g. to remove 'item1.xml' the given path should be 'customXml/item1.xml'. If the file is refered to from the document.xml the removal is canceled and the method returns an error. This method also removes the following references : the related 'customXml/itemPropsX.xml' file, the related 'customXml/_rels/itemX.xml.rels' and the relationship reference in the 'word/_rels/document.xml.rels' path argument shall be given as an absolute path where the root is that of the OPC. When an error is returned customXml Part is not removed. If the reason is that no customXml part was found for the given path then a 'docx.NoCustomXmlPartError' is returned. If the reason is that the designated customXml Part has existing relationships then a 'docx.ExistingRelationshipsError' is returned
func (*Docx) RemoveElementsFromMainDocument ¶
removeElementFromMainDocument finds an element defined by the 'elementXpath' ( if no corresponding element Node found returns a 'NoElementsFoundAtXPath' error).
func (*Docx) ReplaceFooter ¶
func (*Docx) ReplaceHeader ¶
func (*Docx) ReplaceLink ¶
func (*Docx) WriteToFile ¶
type ExistingRelationshipsError ¶
type ExistingRelationshipsError struct {
// contains filtered or unexported fields
}
ExistingRelationshipsError is returned when trying to remove a customXML Part that still has existing relationships
func (ExistingRelationshipsError) Error ¶
func (e ExistingRelationshipsError) Error() string
type NoCustomXmlPartError ¶
type NoCustomXmlPartError struct {
// contains filtered or unexported fields
}
NoCustomXmlPartError is returned when trying to remove a CustomXML Part that can't be found
func (NoCustomXmlPartError) Error ¶
func (e NoCustomXmlPartError) Error() string
type NoElementsFoundAtXPath ¶
type NoElementsFoundAtXPath struct {
// contains filtered or unexported fields
}
func (NoElementsFoundAtXPath) Error ¶
func (e NoElementsFoundAtXPath) Error() string
type ReplaceDocx ¶
type ReplaceDocx struct {
// contains filtered or unexported fields
}
func ReadDocx ¶
func ReadDocx(reader ZipData) (*ReplaceDocx, error)
func ReadDocxFile ¶
func ReadDocxFile(path string) (*ReplaceDocx, error)
func ReadDocxFromMemory ¶
func ReadDocxFromMemory(data io.ReaderAt, size int64) (*ReplaceDocx, error)
func (*ReplaceDocx) Close ¶
func (r *ReplaceDocx) Close() error
func (*ReplaceDocx) Editable ¶
func (r *ReplaceDocx) Editable() *Docx
type ZipData ¶
type ZipData interface {
// contains filtered or unexported methods
}
Contains functions to work with data from a zip file
type ZipFile ¶
type ZipFile struct {
// contains filtered or unexported fields
}
Type for zip files read from disk
type ZipInMemory ¶
type ZipInMemory struct {
// contains filtered or unexported fields
}
Type for in memory zip files