Documentation ¶
Index ¶
- func DefaultEncode(object interface{}) (string, error)
- func RelationshipPath(path string) string
- func TargetPath(src, dst Part) string
- type AppProps
- type ContentTypes
- type CoreProps
- type DefaultType
- type Drawing
- type DrawingRel
- type OverrideType
- type Package
- type Part
- type Relationship
- type Relationships
- type Sheet
- type SheetData
- type SheetFormat
- type Sheets
- type Spreadsheet
- type Workbook
- type Worksheet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEncode ¶
DefaultEncode returns an encoded xml string.
func RelationshipPath ¶
RelationshipPath returns the relationship file path that is relative to the given file.
func TargetPath ¶
TargetPath returns the relative path from source part file to target part file.
Types ¶
type AppProps ¶
type AppProps struct { XMLName xml.Name `xml:"Properties"` Namespace string `xml:"xmlns,attr"` VtNameSpace string `xml:"xmlns:vt,attr"` Application string }
AppProps is a on of file properties for Excel.
type ContentTypes ¶
type ContentTypes struct { XMLName xml.Name `xml:"Types"` Namespace string `xml:"xmlns,attr"` Defaults []DefaultType Overrides []OverrideType }
ContentTypes specify the content types in the archive.
func NewContentTypes ¶
func NewContentTypes() *ContentTypes
NewContentTypes creates a new content types.
func (*ContentTypes) AddDefault ¶
func (c *ContentTypes) AddDefault(item DefaultType)
AddDefault adds a default type.
func (*ContentTypes) AddOverride ¶
func (c *ContentTypes) AddOverride(item OverrideType)
AddOverride adds an override type.
func (*ContentTypes) Content ¶
func (c *ContentTypes) Content() string
Content returns an xml string generated from object contents.
func (*ContentTypes) Path ¶
func (c *ContentTypes) Path() string
Path returns the file path in the archive.
type CoreProps ¶
type CoreProps struct { XMLName xml.Name `xml:"cp:coreProperties"` PropNamespace string `xml:"xmlns:cp,attr"` DcNameSpace string `xml:"xmlns:dc,attr"` DcTermsNameSpace string `xml:"xmlns:dcterms,attr"` DcmiTypeNameSpace string `xml:"xmlns:dcmitype,attr"` XSINameSpace string `xml:"xmlns:xsi,attr"` }
CoreProps is 'Core Properties' that is defined in OPC.
type DefaultType ¶
type DefaultType struct { XMLName xml.Name `xml:"Default"` Extension string `xml:",attr"` ContentType string `xml:",attr"` }
DefaultType is the content type per extension.
type Drawing ¶
type Drawing struct { XMLName xml.Name `xml:"xdr:wsDr"` Namespace string `xml:"xmlns:xdr,attr"` AnchorNamespace string `xml:"xmlns:a,attr"` Shapes []shape.Shape // contains filtered or unexported fields }
Drawing is a drawing object.
func (*Drawing) UnshiftShape ¶ added in v0.0.3
UnshiftShape inserts a shape into the head of shape list.
type DrawingRel ¶
DrawingRel is a relationships of the drawing.
type OverrideType ¶
type OverrideType struct { XMLName xml.Name `xml:"Override"` PartName string `xml:",attr"` ContentType string `xml:",attr"` }
OverrideType is the content type per file.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package implements OpenXML SpreadSheetPackage.
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"` }
Relationship has a relation between a source part and a target part.
type Relationships ¶
type Relationships struct { XMLName xml.Name `xml:"Relationships"` Namespace string `xml:"xmlns,attr"` Items []Relationship // contains filtered or unexported fields }
Relationships contains zero or more relationship.
func NewRelationships ¶
func NewRelationships(path string) *Relationships
NewRelationships creates new relationships.
func (*Relationships) Content ¶
func (r *Relationships) Content() string
Content returns an xml string generated from object contents.
func (*Relationships) Path ¶
func (r *Relationships) Path() string
Path returns the file path in the archive.
type Sheet ¶
type Sheet struct { XMLName xml.Name `xml:"sheet"` Name string `xml:"name,attr"` SheetID string `xml:"sheetId,attr"` RelationshipID string `xml:"r:id,attr"` }
Sheet is a relationship of the worksheet.
type SheetFormat ¶
type SheetFormat struct { XMLName xml.Name `xml:"sheetFormatPr"` DefaultColumnWidth string `xml:"defaultColWidth,attr,omitempty"` DefaultRowHeight string `xml:"defaultRowHeight,attr,omitempty"` CustomHeight string `xml:"customHeight,attr,omitempty"` }
SheetFormat is a struct.
type Spreadsheet ¶
type Spreadsheet struct {
// contains filtered or unexported fields
}
Spreadsheet creates a consumable Excel file.
func (*Spreadsheet) AddShape ¶
func (ss *Spreadsheet) AddShape(s shape.Shape)
AddShape adds a shape into the drawing collection of this spreadsheet.
func (*Spreadsheet) Dump ¶
func (ss *Spreadsheet) Dump(filename string)
Dump writes out the contents into the new Excel file
func (*Spreadsheet) List ¶
func (ss *Spreadsheet) List() []string
List lists the all paths in this file.
func (*Spreadsheet) UnshiftShape ¶ added in v0.0.3
func (ss *Spreadsheet) UnshiftShape(s shape.Shape)
UnshiftShape adds a shape into the drawing collection of this spreadsheet. The given shape will be drawn under the existing shapes.
type Workbook ¶
type Workbook struct { XMLName xml.Name `xml:"workbook"` Namespace string `xml:"xmlns,attr"` RelNameSpace string `xml:"xmlns:r,attr"` Sheets Sheets // contains filtered or unexported fields }
Workbook contains one or more worksheet.
func (*Workbook) Relationships ¶
func (wb *Workbook) Relationships() *Relationships
Relationships returns the relationships associated to this.
type Worksheet ¶
type Worksheet struct { XMLName xml.Name `xml:"worksheet"` Namespace string `xml:"xmlns,attr"` RelNameSpace string `xml:"xmlns:r,attr"` SheetFormat SheetFormat SheetData SheetData DrawingRels []DrawingRel // contains filtered or unexported fields }
Worksheet is a worksheet.
func (*Worksheet) AddDrawing ¶
AddDrawing adds a drawing relationship into this.
func (*Worksheet) Relationships ¶
func (ws *Worksheet) Relationships() *Relationships
Relationships returns the relationships associated to this.
func (*Worksheet) SetDefaultCellSize ¶
SetDefaultCellSize sets the default size of cell.