Documentation
¶
Overview ¶
Package gooxml provides creation, reading, and writing of ECMA 376 Open Office XML documents, spreadsheets and presentations. It is still early in development, but is progressing quickly. This library takes a slightly different approach from others, in that it starts by trying to support all of the ECMA-376 standard when marshaling/unmarshaling XML documents. From there it adds wrappers around the ECMA-376 derived types that provide a more convenient interface.
The raw XML based types reside in the ```schema/``` directory. These types are always accessible from the wrapper types via a ```X()``` method that returns the raw type. Except for the base documents (document.Document, spreadsheet.Workbook and presentation.Presentation), the other wrapper types are value types with non-pointer methods. They exist solely to modify and return data from one or more XML types.
The packages of interest are baliance.com/gooxml/document, baliance/gooxml/spreadsheet and baliance.com/gooxml/presentation.
Example (Document) ¶
package main
import (
"baliance.com/gooxml/document"
)
func main() {
// see the baliance.com/gooxml/document documentation or _examples/document
// for more examples
doc := document.New()
doc.AddParagraph().AddRun().AddText("Hello World!")
doc.SaveToFile("document.docx")
}
Index ¶
- func AddPreserveSpaceAttr(se *xml.StartElement, s string)
- func Bool(v bool) *bool
- func Float64(v float64) *float64
- func Int32(v int32) *int32
- func Int64(v int64) *int64
- func NeedsSpacePreserve(s string) bool
- func RegisterConstructor(ns, name string, fn interface{})
- func String(v string) *string
- func Uint32(v uint32) *uint32
- func Uint64(v uint64) *uint64
- type Any
- type XSDAny
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPreserveSpaceAttr ¶
func AddPreserveSpaceAttr(se *xml.StartElement, s string)
AddPreserveSpaceAttr adds an xml:space="preserve" attribute to a start element if it is required for the string s.
func NeedsSpacePreserve ¶
NeedsSpacePreserve returns true if the string has leading or trailing space.
Types ¶
type Any ¶
type Any interface {
MarshalXML(e *xml.Encoder, start xml.StartElement) error
UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
}
Any is the interface used for marshaling/unmarshaling xsd:any
func CreateElement ¶
func CreateElement(start xml.StartElement) (Any, error)
CreateElement creates an element with the given namespace and name. It is used to unmarshal some xsd:any elements to the appropriate concrete type.
Source Files
¶
- creator.go
- doc.go
- optional.go
- xml.go
- xsdany.go
Directories
¶
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
document/doc-properties
command
|
|
|
document/fill-out-form
command
|
|
|
document/header-footer
command
|
|
|
document/header-footer-multiple
command
|
|
|
document/image
command
|
|
|
document/simple
command
|
|
|
document/tables
command
|
|
|
document/toc
command
|
|
|
document/use-template
command
|
|
|
presentation/simple
command
|
|
|
spreadsheet/formula
command
|
|
|
spreadsheet/simple
command
|
|
|
spreadsheet/wrapped-text
command
|
|
|
cmd
|
|
|
catdoc
command
|
|
|
docx2md
command
|
|
|
Package document provides creation, reading, and writing of ECMA 376 Open Office XML documents.
|
Package document provides creation, reading, and writing of ECMA 376 Open Office XML documents. |
|
schema
|
|