Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(dstFileName string, srcFileName string) (written int64, err error)
- func GenerateFileName(fName, suffix string, replace bool) (tempName string)
- func GenerateId(sid, suffix, separation string) (toId string)
- func GetBreakPage() (tag *yaxml.Element)
- func GetChunkContenDom(filename string) (dom *yaxml.Element)
- func GetChunkDom(rid string) (dom *yaxml.Element)
- func GetChunkRelationDom(filename, rid string) (dom *yaxml.Element)
- func GetImageDom(rid string, width int, height int, align string) (dom *yaxml.Element)
- func GetImageRelationshipDom(rid, filename string) (dom *yaxml.Element)
- func GetJpgContenttype() (dom *yaxml.Element)
- func GetPngContenttype() (dom *yaxml.Element)
- func GetTextDom(text, align string) (dom *yaxml.Element)
- func MergeFiles(filelist []string, filename string, page bool) (err error)
- func NumToHans(num int) string
- func Parser(text string) *yaxml.Element
- func PathExists(path string) (bool, error)
- func ReadAll(filePth string) (string, error)
- func Unzip(zipFile string, destDir string) error
- type ContentTypes
- func (c *ContentTypes) AppendDocx(filename string)
- func (c *ContentTypes) AppendExtension(suffix string)
- func (c *ContentTypes) AppendJpeg()
- func (c *ContentTypes) AppendPng()
- func (c *ContentTypes) GetDom() *yaxml.Element
- func (c *ContentTypes) GetTypes() []string
- func (c *ContentTypes) GetTypesDom() (types []*yaxml.Element)
- func (c *ContentTypes) ToString() string
- type Document
- func (d *Document) AppendChunk(rid string)
- func (d *Document) AppendContent(dom *yaxml.Element)
- func (d *Document) AppendPageBreak()
- func (d *Document) AppendParagraph(text string, align string)
- func (d *Document) AppendPicture(rid string, width int, height int, align string)
- func (d *Document) ClearContent()
- func (d *Document) ClearContentWithoutHeader()
- func (d *Document) GetContent() (par []*Paragraph)
- func (d *Document) GetDom(dom *yaxml.Element) *yaxml.Element
- func (d *Document) ToString() string
- type Docx
- func (d *Docx) AppendParagraph(text, align string)
- func (d *Docx) AppendPicture(srcfilepath, align string) (err error)
- func (d *Docx) Close()
- func (d *Docx) GetDocument() (*Document, error)
- func (d *Docx) GetRelationships(refresh bool) (*Relationships, error)
- func (d *Docx) Merge(filelist []string, page bool, remove bool) (err error)
- func (d *Docx) Replace(src, des string)
- func (d *Docx) Save(name string) (err error)
- func (d *Docx) Zip(destZip string) error
- type IdAble
- type Paragraph
- type Relationships
- func (r *Relationships) AppendChunk(filename string) string
- func (r *Relationships) AppendRelationship(suffix string) (res map[string]string)
- func (r *Relationships) GenerateId() string
- func (r *Relationships) GetDom() (dom *yaxml.Element)
- func (r *Relationships) GetFileMapping() map[string]string
- func (r *Relationships) GetRelationships() (ralation []*yaxml.Element)
- func (r *Relationships) ToString() string
Constants ¶
View Source
const ( LEFT = "left" RIGHt = "right" )
Variables ¶
View Source
var ( UNIT = [5]string{"", "十", "百", "千", "万"} NUM = [10]string{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"} )
View Source
var TEMP_BASE_DIR = path.Join("/tmp", "/docx_temp")
Functions ¶
func GenerateFileName ¶
func GenerateId ¶
func GetBreakPage ¶
func GetChunkContenDom ¶
func GetChunkDom ¶
func GetChunkRelationDom ¶
func GetImageDom ¶
func GetImageRelationshipDom ¶
func GetJpgContenttype ¶
func GetPngContenttype ¶
func GetTextDom ¶
func PathExists ¶
Types ¶
type ContentTypes ¶
func GenerateContentTypes ¶
func GenerateContentTypes(content *yaxml.Element) (ct *ContentTypes)
func (*ContentTypes) AppendDocx ¶
func (c *ContentTypes) AppendDocx(filename string)
func (*ContentTypes) AppendExtension ¶
func (c *ContentTypes) AppendExtension(suffix string)
func (*ContentTypes) AppendJpeg ¶
func (c *ContentTypes) AppendJpeg()
func (*ContentTypes) AppendPng ¶
func (c *ContentTypes) AppendPng()
func (*ContentTypes) GetDom ¶
func (c *ContentTypes) GetDom() *yaxml.Element
func (*ContentTypes) GetTypes ¶
func (c *ContentTypes) GetTypes() []string
func (*ContentTypes) GetTypesDom ¶
func (c *ContentTypes) GetTypesDom() (types []*yaxml.Element)
func (*ContentTypes) ToString ¶
func (c *ContentTypes) ToString() string
type Document ¶
func GenerateDocument ¶
func (*Document) AppendChunk ¶
func (*Document) AppendContent ¶
func (*Document) AppendPageBreak ¶
func (d *Document) AppendPageBreak()
func (*Document) AppendParagraph ¶
func (*Document) AppendPicture ¶
func (*Document) ClearContent ¶
func (d *Document) ClearContent()
func (*Document) ClearContentWithoutHeader ¶
func (d *Document) ClearContentWithoutHeader()
func (*Document) GetContent ¶
type Docx ¶
type Docx struct { *IdAble Document *Document ContentTypes *ContentTypes Relationships *Relationships Numbering string Styles string BaseDir string FilePath string ReplaceMap map[string]string RelsDict map[string]string RelsFiles map[string]bool CurrentIdTarget map[string]bool }
func MakeNewDocument ¶
func (*Docx) AppendParagraph ¶
func (*Docx) AppendPicture ¶
func (*Docx) GetDocument ¶
func (*Docx) GetRelationships ¶
func (d *Docx) GetRelationships(refresh bool) (*Relationships, error)
type Relationships ¶
func GenerateRelationships ¶
func GenerateRelationships(relationships *yaxml.Element) *Relationships
func (*Relationships) AppendChunk ¶
func (r *Relationships) AppendChunk(filename string) string
func (*Relationships) AppendRelationship ¶
func (r *Relationships) AppendRelationship(suffix string) (res map[string]string)
func (*Relationships) GenerateId ¶
func (r *Relationships) GenerateId() string
func (*Relationships) GetDom ¶
func (r *Relationships) GetDom() (dom *yaxml.Element)
func (*Relationships) GetFileMapping ¶
func (r *Relationships) GetFileMapping() map[string]string
func (*Relationships) GetRelationships ¶
func (r *Relationships) GetRelationships() (ralation []*yaxml.Element)
func (*Relationships) ToString ¶
func (r *Relationships) ToString() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.