Documentation ¶
Index ¶
Constants ¶
const ( // XMLText tag skeleton XMLText = `` /* 147-byte string literal not displayed */ // XMLCenterText tag skeleton XMLCenterText = `` /* 188-byte string literal not displayed */ // XMLCenterBoldText tag skeleton XMLCenterBoldText = `` /* 221-byte string literal not displayed */ // XMLBoldText tag skeleton XMLBoldText = `` /* 145-byte string literal not displayed */ // XMLInlineText tag skeleton XMLInlineText = `<w:r> <w:t>%s</w:t> </w:r> ` // XMLFontStyle defines fontStyle XMLFontStyle = `<w:pPr> <w:pStyle w:val="%s"/> <w:jc w:val="center"/> <w:textAlignment w:val="center"/> </w:pPr> ` // XMLTableHead ... XMLTableHead = `<w:tbl> <w:tblPr> <w:tblStyle w:val="a3"/> <w:tblW w:w="0" w:type="auto"/> </w:tblPr> ` // XMLTableNoHead tag skeleton XMLTableNoHead = `<w:tbl> <w:tblPr> <w:tblStyle w:val="a3"/> <w:tblW w:w="0" w:type="auto"/> </w:tblPr> ` // XMLTableInTableHead tag skeleton XMLTableInTableHead = `` /* 216-byte string literal not displayed */ // XMLTableInTableNoHead ... XMLTableInTableNoHead = `` /* 217-byte string literal not displayed */ // XMLTableTR ... XMLTableTR = `<w:tr w14:paraId="7F912C80" w14:textId="77777777" w:rsidR="00102180" w:rsidTr="00102180"> ` // XMLTableHeadTR ... XMLTableHeadTR = `<w:tr w14:paraId="7F912C80" w14:textId="77777777" w:rsidR="00102180" w:rsidTr="00102180"> ` // XMLTableTD ... XMLTableTD = `<w:tc> <w:tcPr> <w:tcW w:w="%s" w:type="dxa"/> <w:gridSpan w:val="%s"/> </w:tcPr> ` // XMLTableMergeSTD ... XMLTableMergeSTD = `` /* 154-byte string literal not displayed */ // XMLTableMergeCTD ... XMLTableMergeCTD = `` /* 175-byte string literal not displayed */ // XMLTableInTableTD ... XMLTableInTableTD = `<w:tc> <w:tcPr> <w:tcW w:w="%s" w:type="dxa"/> </w:tcPr> ` // XMLTableInTableMergeSTD ... XMLTableInTableMergeSTD = `` /* 127-byte string literal not displayed */ // XMLTableInTableMergeCTD ... XMLTableInTableMergeCTD = `` /* 148-byte string literal not displayed */ // XMLTableTD2 ... XMLTableTD2 = `<w:p> <w:pPr> <w:tabs> <w:tab w:val="center" w:pos="1312"/> </w:tabs> <w:textAlignment w:val="center"/> </w:pPr> ` // XMLHeadTableTDBegin ... XMLHeadTableTDBegin = `<w:tc> <w:tcPr> <w:tcW w:w="%s" w:type="dxa"/> </w:tcPr> ` // XMLHeadTableInTableTDBegin ... XMLHeadTableInTableTDBegin = `<w:tc> <w:tcPr> <w:tcW w:w="%s" w:type="dxa"/> </w:tcPr> ` // XMLHeadTableTDBegin2 ... XMLHeadTableTDBegin2 = `<w:p> <w:pPr> <w:textAlignment w:val="left"/> </w:pPr> ` // XMLHeadTableTDBegin2C ... XMLHeadTableTDBegin2C = `<w:p> <w:pPr> <w:textAlignment w:val="center"/> </w:pPr> ` // XMLHeadtableTDTextB ... XMLHeadtableTDTextB = `` /* 146-byte string literal not displayed */ // XMLHeadtableTDTextC ... XMLHeadtableTDTextC = `` /* 179-byte string literal not displayed */ // XMLHeadtableTDTextBC ... XMLHeadtableTDTextBC = `` /* 189-byte string literal not displayed */ // XMLHeadtableTDText ... XMLHeadtableTDText = `` /* 202-byte string literal not displayed */ // XMLTableGridBegin ... XMLTableGridBegin = `<w:tblGrid> ` // XMLTableGridCol ... XMLTableGridCol = `<w:gridCol w:w="%s" /> ` // XMLTableGridEnd ... XMLTableGridEnd = ` </w:tblGrid> ` // XMLHeadTableTDEnd ... XMLHeadTableTDEnd = ` </w:tc> ` // XMLTableEndTR ... XMLTableEndTR = `</w:tr> ` XMLMagicFooter = `` /* 168-byte string literal not displayed */ XMLTableFooter = ` </w:tbl> ` // XMLIMGtail ... XMLIMGtail = `</w:p> ` // XMLBr ... XMLBr = `<w:p/> ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docx ¶
type Docx struct {
// contains filtered or unexported fields
}
Docx object is the main object that functions do manipulation on
func Open ¶
Open func will open a docx file and will return array of zip.File and the main content to manipulate
func (*Docx) CreateTable ¶
func (d *Docx) CreateTable(tbname string, inline bool, tableBody [][]*TableTD, tableHead []*TableTHead, headCenter bool) (*Table, error)
CreateTable inserts a table in the document sample right now it needs to have a pre-defind node in the document.xml inside the docx file to be inserted to
func (*Docx) ReplaceImage ¶
func (d *Docx) ReplaceImage(imgs []ReplaceImages)
ReplaceImage func will apend an array of ReplaceImages object which will eventually cause the Write func to replace the images
func (*Docx) ReplaceText ¶
ReplaceText func will change the oldString defind in the template with the given newString and n is the number of instances to replace, use -1 to replace all
type ReplaceImages ¶
ReplaceImages defines the images to be replaced in the sample document and the Dst images needs to be known before-hand
type Table ¶
type Table struct { //Tbname is the name of the table Tbname string `json:"tbname"` //Text OR Image in the sanme line Inline bool `json:"inline"` //Table data except table head TableBody [][]*TableTD `json:"tablebody"` //Table head data TableHead []*TableTHead `json:"tablehead"` //Thcenter set table head center word Thcenter bool `json:"thcenter"` }
Table include table configuration.
type TableTD ¶
type TableTD struct { // TData refers block's element TData []interface{} `json:"tdata"` // TDBG refers block's background TDBG int `json:"tdbg"` TDW int `json:"tdw"` TDM int `json:"tdm"` }
TableTD descripes every block of the table
func NewTableTD ¶
NewTableTD ...
type TableTHead ¶
type TableTHead struct { TData interface{} `json:"tdata"` TDW int `json:"tdw"` }
TableTHead definition