Documentation ¶
Index ¶
- type Body
- type BodyParams
- type BoolValue
- type ColSpaceValue
- type DocGridValue
- type DocItem
- type DocItemType
- type Document
- type EmptyValue
- type FloatValue
- type Header
- type HeightValue
- type IntValue
- type MarginValue
- type Margins
- type ParagraphInd
- type ParagraphItem
- type ParagraphParams
- type ParagraphTab
- type ParagraphTabs
- type RecordFonts
- type RecordItem
- type RecordParamSize
- type RecordParams
- type ReferenceValue
- type SectionParam
- type ShadowValue
- type SimpleDocxFile
- type SizeValue
- type SpacingValue
- type StringValue
- type TableBorder
- type TableBorders
- type TableCell
- type TableCellParams
- type TableGrid
- type TableItem
- type TableLayout
- type TableLook
- type TableParams
- type TableParamsEx
- type TableRow
- type TableRowParams
- type WidthValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body struct { Items []DocItem Params BodyParams `xml:"sectPr"` }
Body - тело документа
type BodyParams ¶
type BodyParams struct { HeaderReference *ReferenceValue `xml:"headerReference,omitempty"` PageSize SizeValue `xml:"pgSz"` PageMargin MarginValue `xml:"pgMar"` Bidi IntValue `xml:"bidi"` }
BodyParams - параметры тела документа
type BoolValue ¶
type BoolValue struct {
Value bool `xml:"val,attr"`
}
BoolValue - одиночное bool значение
type ColSpaceValue ¶ added in v0.2.1
type ColSpaceValue struct {
Space string `xml:"space,attr"`
}
type DocGridValue ¶ added in v0.2.1
type DocGridValue struct {
LinePitch string `xml:"linePitch,attr"`
}
type DocItem ¶
type DocItem interface { SetAttrs(attrs []xml.Attr) Tag() string Type() DocItemType PlainText() string Clone() DocItem // contains filtered or unexported methods }
DocItem - интерфейс элемента документа
type DocItemType ¶
type DocItemType int
DocItemType - тип элемента
const ( Paragraph DocItemType = iota Record Table )
Paragraph - параграф
type Document ¶
Document - документ разметки DOCX
type FloatValue ¶
type FloatValue struct {
Value float64 `xml:"val,attr"`
}
FloatValue - одиночное float значение
type Header ¶
Header - разметка заголовка DOCX
type HeightValue ¶
type HeightValue struct { Value int64 `xml:"val,attr"` HeightRule string `xml:"hRule,attr,omitempty"` }
HeightValue - значение высоты
type IntValue ¶
type IntValue struct {
Value int64 `xml:"val,attr"`
}
IntValue - одиночное int значение
type MarginValue ¶
type MarginValue struct { Top int64 `xml:"top,attr"` Left int64 `xml:"left,attr"` Bottom int64 `xml:"bottom,attr"` Right int64 `xml:"right,attr"` Header int64 `xml:"header,attr,omitempty"` }
MarginValue - margin значение
type Margins ¶
type Margins struct { Top WidthValue `xml:"top"` Left WidthValue `xml:"left"` Bottom WidthValue `xml:"bottom"` Right WidthValue `xml:"right"` }
Margins - margins значение
type ParagraphInd ¶ added in v0.2.1
type ParagraphInd struct { Left string `xml:"left,attr"` Right string `xml:"right,attr"` Hanging string `xml:"hanging,attr"` FirstLine string `xml:"firstLine,attr"` }
ParagraphInd = <w:ind w:left="2136" w:right="1209" w:hanging="882" w:firstLine="223"/>
type ParagraphItem ¶
type ParagraphItem struct { Params ParagraphParams `xml:"pPr"` Items []DocItem Attrs []xml.Attr }
ParagraphItem - параграф
func (*ParagraphItem) SetAttrs ¶ added in v0.2.1
func (item *ParagraphItem) SetAttrs(attrs []xml.Attr)
type ParagraphParams ¶
type ParagraphParams struct { Style *StringValue `xml:"pStyle,omitempty"` Tabs *ParagraphTabs `xml:"tabs,omitempty"` Spacing *SpacingValue `xml:"spacing,omitempty"` Jc *StringValue `xml:"jc,omitempty"` Bidi *IntValue `xml:"bidi,omitempty"` Size *StringValue `xml:"sz"` ParagraphRecordParams *RecordParams `xml:"rPr"` Ind *ParagraphInd `xml:"ind"` Section *SectionParam `xml:"sectPr,omitempty"` }
ParagraphParams - параметры параграфа
type ParagraphTab ¶ added in v0.2.1
type ParagraphTabs ¶ added in v0.2.1
type ParagraphTabs struct {
Tab []*ParagraphTab `xml:"tab"`
}
type RecordFonts ¶
type RecordFonts struct { ASCII string `xml:"ascii,attr"` CS string `xml:"cs,attr"` HandleANSI string `xml:"hAnsi,attr"` EastAsia string `xml:"eastAsia,attr"` HandleInt string `xml:"hint,attr,omitempty"` }
RecordFonts - fonts in record
type RecordItem ¶
type RecordItem struct { PageBreak bool `xml:"lastRenderedPageBreak,omitempty"` Attrs []xml.Attr Params RecordParams `xml:"rPr,omitempty"` Text string `xml:"t,omitempty"` Tab bool `xml:"tab,omitempty"` Break bool `xml:"br,omitempty"` }
RecordItem - record item
func (*RecordItem) SetAttrs ¶ added in v0.2.1
func (item *RecordItem) SetAttrs(attrs []xml.Attr)
type RecordParamSize ¶ added in v0.2.1
type RecordParamSize struct {
Value string `xml:"val,attr"`
}
type RecordParams ¶
type RecordParams struct { Fonts *RecordFonts `xml:"rFonts,omitempty"` Rtl *IntValue `xml:"rtl,omitempty"` Size *RecordParamSize `xml:"sz,omitempty"` SizeCs *IntValue `xml:"szCs,omitempty"` Lang *StringValue `xml:"lang,omitempty"` Underline *StringValue `xml:"u,omitempty"` Italic *EmptyValue `xml:"i,omitempty"` Bold *EmptyValue `xml:"b,omitempty"` BoldCS *EmptyValue `xml:"bCs,omitempty"` Color *StringValue `xml:"color,omitempty"` }
RecordParams - params record
type ReferenceValue ¶
ReferenceValue - reference value
type SectionParam ¶ added in v0.2.1
type SectionParam struct { HeaderReference *ReferenceValue `xml:"headerReference,omitempty"` Type *StringValue `xml:"type,omitempty"` PageSize *SizeValue `xml:"pgSz,omitempty"` PageMargin *MarginValue `xml:"pgMar,omitempty"` Columns *ColSpaceValue `xml:"cols,omitempty"` DocumentGrid *DocGridValue `xml:"docGrid,omitempty"` }
type ShadowValue ¶
type ShadowValue struct { Value string `xml:"val,attr"` Color string `xml:"color,attr"` Fill string `xml:"fill,attr"` }
ShadowValue - значение тени
type SimpleDocxFile ¶
type SimpleDocxFile struct {
// contains filtered or unexported fields
}
SimpleDocxFile - файл docx
func OpenFile ¶
func OpenFile(fileName string) (*SimpleDocxFile, error)
OpenFile - Открытие файла DOCX
func (*SimpleDocxFile) Render ¶
func (f *SimpleDocxFile) Render(v interface{}) error
Render (SimpleDocxFile) - рендер шаблона
func (*SimpleDocxFile) RenderHeader ¶
func (f *SimpleDocxFile) RenderHeader(index int, v interface{}) error
RenderHeader (SimpleDocxFile) - рендер заголовка шаблона
func (*SimpleDocxFile) Save ¶
func (f *SimpleDocxFile) Save(fileName string) error
Save (SimpleDocxFile) - сохранить
type SizeValue ¶
type SizeValue struct { Width int64 `xml:"w,attr"` Height int64 `xml:"h,attr"` Orientation string `xml:"orient,attr,omitempty"` }
SizeValue - значение размера
type SpacingValue ¶
type SpacingValue struct { After string `xml:"after,attr"` Before string `xml:"before,attr"` Line string `xml:"line,attr"` LineRule string `xml:"lineRule,attr"` }
SpacingValue - spacing value
type StringValue ¶
type StringValue struct {
Value string `xml:"val,attr,omitempty"`
}
StringValue - одиночное string значение
type TableBorder ¶
type TableBorder struct { Value string `xml:"val,attr"` Color string `xml:"color,attr"` Size int64 `xml:"sz,attr"` Space int64 `xml:"space,attr"` Shadow int64 `xml:"shadow,attr"` Frame int64 `xml:"frame,attr"` }
TableBorder in borders
type TableBorders ¶
type TableBorders struct { Top TableBorder `xml:"top"` Left TableBorder `xml:"left"` Bottom TableBorder `xml:"bottom"` Right TableBorder `xml:"right"` InsideH *TableBorder `xml:"insideH,omitempty"` InsideV *TableBorder `xml:"insideV,omitempty"` }
TableBorders in table
type TableCell ¶
type TableCell struct { Params TableCellParams `xml:"tcPr"` Items []DocItem }
TableCell - table cell
type TableCellParams ¶
type TableCellParams struct { Width *WidthValue `xml:"tcW,omitempty"` Borders *TableBorders `xml:"tcBorders,omitempty"` Shadow *ShadowValue `xml:"shd,omitempty"` Margins *Margins `xml:"tcMar,omitempty"` VerticalAlign *StringValue `xml:"vAlign,omitempty"` VerticalMerge *StringValue `xml:"vMerge,omitempty"` GridSpan *IntValue `xml:"gridSpan,omitempty"` HideMark *EmptyValue `xml:"hideMark,omitempty"` NoWrap *EmptyValue `xml:"noWrap,omitempty"` }
TableCellParams - cell params
type TableGrid ¶
type TableGrid struct {
Cols []*WidthValue `xml:"gridCol,omitempty"`
}
TableGrid - Grid table
type TableItem ¶
type TableItem struct { Attrs []xml.Attr Params TableParams `xml:"tblPr"` Grid TableGrid `xml:"tblGrid"` Rows []*TableRow `xml:"tr,omitempty"` }
TableItem - элемент таблици
func (*TableItem) SetAttrs ¶ added in v0.2.1
SetAttrs устанавливает переданные атрибуты элемента. Атрибуты передаются в виде среза xml.Attr Переданный срез атрибутов присваивается полю Attrs элемента TableItem. Example usage:
attrs := []xml.Attr{ xml.Attr{Name: xml.Name{Local: "attr1"}, Value: "value1"}, xml.Attr{Name: xml.Name{Local: "attr2"}, Value: "value2"}, }
item.SetAttrs(attrs)
type TableLayout ¶
type TableLayout struct {
Type string `xml:"type,attr"`
}
TableLayout - layout params
type TableLook ¶ added in v0.2.1
type TableLook struct { Value string `xml:"val,attr"` FirstRow string `xml:"firstRow,attr"` LastRow string `xml:"lastRow,attr"` FirstColumn string `xml:"firstColumn,attr"` LastColumn string `xml:"lastColumn,attr"` NoHBand string `xml:"noHBand,attr"` NoVBand string `xml:"noVBand,attr"` }
TableLook <w:tblLook w:val="01E0" w:firstRow="1" w:lastRow="1" w:firstColumn="1" w:lastColumn="1" w:noHBand="0" w:noVBand="0"/>
type TableParams ¶
type TableParams struct { Width *WidthValue `xml:"tblW,omitempty"` Style *StringValue `xml:"tblStyle,omitempty"` Jc *StringValue `xml:"jc,omitempty"` Ind *WidthValue `xml:"tblInd,omitempty"` Borders *TableBorders `xml:"tblBorders,omitempty"` Shadow *ShadowValue `xml:"shd,omitempty"` Layout *TableLayout `xml:"tblLayout,omitempty"` DocGrid *IntValue `xml:"docGrid,omitempty"` Look *TableLook `xml:"tblLook,omitempty"` }
TableParams - Params table
type TableParamsEx ¶
type TableParamsEx struct {
Shadow ShadowValue `xml:"shd"`
}
TableParamsEx - Other params table
type TableRow ¶
type TableRow struct { Attr []xml.Attr OtherParams *TableParamsEx `xml:"tblPrEx,omitempty"` Params TableRowParams `xml:"trPr"` Cells []*TableCell `xml:"tc,omitempty"` }
TableRow - row in table
type TableRowParams ¶
type TableRowParams struct { Height HeightValue `xml:"trHeight"` IsHeader bool }
TableRowParams - row params
type WidthValue ¶
WidthValue - значение длины