Documentation
¶
Overview ¶
Package unioffice provides creation, reading, and writing of ECMA 376 Office Open 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 github.com/golgys0621/gooffice/document, github.com/golgys0621/gooffice/spreadsheet and github.com/golgys0621/gooffice/presentation.
Index ¶
- Constants
- Variables
- func AbsoluteFilename(dt DocType, typ string, index int) string
- func AbsoluteImageFilename(dt DocType, index int, fileExtension string) string
- func AddPreserveSpaceAttr(se *_g.StartElement, s string)
- func Bool(v bool) *bool
- func DisableLogging()
- func Float32(v float32) *float32
- func Float64(v float64) *float64
- func Int8(v int8) *int8
- func Int32(v int32) *int32
- func Int64(v int64) *int64
- func NeedsSpacePreserve(s string) bool
- func RegisterConstructor(ns, name string, fn interface{})
- func RelativeFilename(dt DocType, relToTyp, typ string, index int) string
- func RelativeImageFilename(dt DocType, relToTyp, typ string, index int, fileExtension string) string
- func String(v string) *string
- func Stringf(f string, args ...interface{}) *string
- func Uint8(v uint8) *uint8
- func Uint16(v uint16) *uint16
- func Uint32(v uint32) *uint32
- func Uint64(v uint64) *uint64
- type Any
- type DocType
- type XSDAny
Constants ¶
const ( OfficeDocumentTypeStrict = "" /* 400-byte string literal not displayed */ StylesTypeStrict = "" /* 347-byte string literal not displayed */ ThemeTypeStrict = "" /* 341-byte string literal not displayed */ ControlTypeStrict = "" /* 328-byte string literal not displayed */ SettingsTypeStrict = "" /* 349-byte string literal not displayed */ ImageTypeStrict = "" /* 341-byte string literal not displayed */ CommentsTypeStrict = "" /* 349-byte string literal not displayed */ ThumbnailTypeStrict = "" /* 409-byte string literal not displayed */ DrawingTypeStrict = "" /* 328-byte string literal not displayed */ ChartTypeStrict = "" /* 341-byte string literal not displayed */ ExtendedPropertiesTypeStrict = "" /* 409-byte string literal not displayed */ CustomXMLTypeStrict = "" /* 365-byte string literal not displayed */ WorksheetTypeStrict = "" /* 365-byte string literal not displayed */ TableTypeStrict = "" /* 341-byte string literal not displayed */ HeaderTypeStrict = "" /* 347-byte string literal not displayed */ NumberingTypeStrict = "" /* 365-byte string literal not displayed */ FontTableTypeStrict = "" /* 365-byte string literal not displayed */ WebSettingsTypeStrict = "" /* 367-byte string literal not displayed */ FootNotesTypeStrict = "" /* 365-byte string literal not displayed */ EndNotesTypeStrict = "" /* 349-byte string literal not displayed */ SlideTypeStrict = "" /* 341-byte string literal not displayed */ VMLDrawingTypeStrict = "" /* 361-byte string literal not displayed */ OfficeDocumentType = "" /* 472-byte string literal not displayed */ StylesType = "" /* 409-byte string literal not displayed */ ThemeType = "" /* 403-byte string literal not displayed */ ThemeContentType = "" /* 295-byte string literal not displayed */ SettingsType = "" /* 431-byte string literal not displayed */ ImageType = "" /* 403-byte string literal not displayed */ ControlType = "" /* 420-byte string literal not displayed */ CommentsType = "" /* 431-byte string literal not displayed */ CommentsContentType = "" /* 352-byte string literal not displayed */ ThumbnailType = "" /* 439-byte string literal not displayed */ DrawingType = "" /* 420-byte string literal not displayed */ DrawingContentType = "" /* 322-byte string literal not displayed */ ChartType = "" /* 403-byte string literal not displayed */ ChartContentType = "" /* 365-byte string literal not displayed */ HyperLinkType = "" /* 417-byte string literal not displayed */ ExtendedPropertiesType = "" /* 477-byte string literal not displayed */ CorePropertiesType = "" /* 480-byte string literal not displayed */ CorePropertiesAltType = "" /* 507-byte string literal not displayed */ CustomPropertiesType = "" /* 480-byte string literal not displayed */ CustomXMLType = "" /* 417-byte string literal not displayed */ TableStylesType = "" /* 439-byte string literal not displayed */ ViewPropertiesType = "" /* 417-byte string literal not displayed */ FontEmbeddingType = "" /* 352-byte string literal not displayed */ WorksheetType = "" /* 417-byte string literal not displayed */ WorksheetContentType = "" /* 403-byte string literal not displayed */ SMLStyleSheetContentType = "" /* 400-byte string literal not displayed */ TableType = "" /* 403-byte string literal not displayed */ TableContentType = "" /* 384-byte string literal not displayed */ HeaderType = "" /* 409-byte string literal not displayed */ NumberingType = "" /* 417-byte string literal not displayed */ FontTableType = "" /* 417-byte string literal not displayed */ WebSettingsType = "" /* 439-byte string literal not displayed */ FootNotesType = "" /* 417-byte string literal not displayed */ EndNotesType = "" /* 431-byte string literal not displayed */ SlideType = "" /* 403-byte string literal not displayed */ SlideContentType = "" /* 400-byte string literal not displayed */ SlideMasterType = "" /* 439-byte string literal not displayed */ SlideMasterContentType = "" /* 431-byte string literal not displayed */ SlideLayoutType = "" /* 439-byte string literal not displayed */ SlideLayoutContentType = "" /* 431-byte string literal not displayed */ PresentationPropertiesType = "" /* 417-byte string literal not displayed */ HandoutMasterType = "" /* 446-byte string literal not displayed */ NotesMasterType = "" /* 439-byte string literal not displayed */ VMLDrawingType = "" /* 408-byte string literal not displayed */ VMLDrawingContentType = "" /* 306-byte string literal not displayed */ CommentsExtendedType = "" /* 391-byte string literal not displayed */ CommentsExtensibleType = "" /* 431-byte string literal not displayed */ CommentsIdsType = "" /* 384-byte string literal not displayed */ )
const ( ContentTypesFilename = "\u005b\u0043\u006f\u006ete\u006e\u0074\u005f\u0054\u0079\u0070\u0065\u0073\u005d\u002e\u0078\u006d\u006c" BaseRelsFilename = "_\u0072\u0065\u006c\u0073\u002f\u002e\u0072\u0065\u006c\u0073" )
const MinGoVersion = _bc
Variables ¶
var Log = _df.Printf
Functions ¶
func AbsoluteFilename ¶
AbsoluteFilename returns the full path to a file from the root of the zip container. Index is used in some cases for files which there may be more than one of (e.g. worksheets/drawings/charts)
func AbsoluteImageFilename ¶
AbsoluteImageFilename returns the full path to an image from the root of the zip container.
func AddPreserveSpaceAttr ¶
func AddPreserveSpaceAttr(se *_g.StartElement, s string)
AddPreserveSpaceAttr adds an xml:space="preserve" attribute to a start element if it is required for the string s.
func DisableLogging ¶
func DisableLogging()
DisableLogging sets the Log function to a no-op so that any log messages are silently discarded.
func NeedsSpacePreserve ¶
NeedsSpacePreserve returns true if the string has leading or trailing space.
func RegisterConstructor ¶
func RegisterConstructor(ns, name string, fn interface{})
RegisterConstructor registers a constructor function used for unmarshaling xsd:any elements.
func RelativeFilename ¶
RelativeFilename returns a filename relative to the source file referenced from a relationships file. Index is used in some cases for files which there may be more than one of (e.g. worksheets/drawings/charts)
func RelativeImageFilename ¶
func RelativeImageFilename(dt DocType, relToTyp, typ string, index int, fileExtension string) string
RelativeImageFilename returns an image filename relative to the source file referenced from a relationships file. It is identical to RelativeFilename but is used particularly for images in order to handle different image formats.
Types ¶
type Any ¶
type Any interface {
MarshalXML(_ef *_g.Encoder, _efd _g.StartElement) error
UnmarshalXML(_fg *_g.Decoder, _a _g.StartElement) error
}
Any is the interface used for marshaling/unmarshaling xsd:any
func CreateElement ¶
func CreateElement(start _g.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.
type DocType ¶
type DocType byte
DocType represents one of the three document types supported (docx/xlsx/pptx)
type XSDAny ¶
XSDAny is used to marshal/unmarshal xsd:any types in the OOXML schema.
func (*XSDAny) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*XSDAny) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package common contains wrapper types and utilities common to all of the OOXML document formats.
|
Package common contains wrapper types and utilities common to all of the OOXML document formats. |
|
tempstorage/memstore
Package memstore implements tempStorage interface by using memory as a storage
|
Package memstore implements tempStorage interface by using memory as a storage |
|
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. |
|
internal
|
|
|
schema
|
|
|
format
Package format provides support for parsing and evaluating spreadsheetml/Excel number formats.
|
Package format provides support for parsing and evaluating spreadsheetml/Excel number formats. |
|
formula
Package formula provides formula parsing and evaluation.
|
Package formula provides formula parsing and evaluation. |
|
update
Package update contains definitions needed for updating references after removing rows/columns.
|
Package update contains definitions needed for updating references after removing rows/columns. |