Documentation ¶
Index ¶
- Constants
- func Register(size string, config *Config)
- type CallBack
- type Cell
- type Config
- type Converter
- func (convert *Converter) AddAtomicCell(cell string)
- func (convert *Converter) AddFont()
- func (convert *Converter) BackgroundColor(line string, elements []string)
- func (convert *Converter) Cell(line string, elements []string)
- func (convert *Converter) CompressLevel(level int)
- func (convert *Converter) Execute()
- func (convert *Converter) ExternalLink(line string, elements []string)
- func (convert *Converter) Font(line string, elements []string)
- func (convert *Converter) GetAutomicCells() []string
- func (convert *Converter) GetBytesPdf() (ret []byte)
- func (convert *Converter) GetXY() (x, y float64)
- func (convert *Converter) Grey(line string, elements []string)
- func (convert *Converter) Image(line string, elements []string)
- func (convert *Converter) InternalLinkAnchor(line string, elements []string)
- func (convert *Converter) InternalLinkLink(line string, elements []string)
- func (convert *Converter) Line(line string, elements []string)
- func (convert *Converter) LineColor(line string, elements []string)
- func (convert *Converter) Margin(line string, eles []string)
- func (convert *Converter) MeasureTextWidth(text string) float64
- func (convert *Converter) NewPage(line string, elements []string)
- func (convert *Converter) NoCompression()
- func (convert *Converter) Oval(line string, elements []string)
- func (convert *Converter) Page(line string, elements []string)
- func (convert *Converter) ReadFile(fileName string) error
- func (convert *Converter) Rect(line string, eles []string)
- func (convert *Converter) SetAutomicCells(cells []string)
- func (convert *Converter) SetFont(family, style string, size int)
- func (convert *Converter) Start(w float64, h float64)
- func (convert *Converter) TextColor(line string, elements []string)
- func (convert *Converter) WritePdf(filepath string)
- type Executor
- type Font
- type FontMap
- type List
- type Report
- func (report *Report) AddCallBack(callback CallBack)
- func (report *Report) AddNewPage(resetpageNo bool)
- func (report *Report) BackgroundColor(x, y, w, h float64, color string, line string)
- func (report *Report) Cell(x float64, y float64, content string)
- func (report *Report) CellGray(x float64, y float64, content string, grayScale float64)
- func (report *Report) CellRight(x float64, y float64, w float64, content string)
- func (report *Report) CompressLevel(level int)
- func (report *Report) Execute(filepath string)
- func (report *Report) ExternalLink(x, y, th float64, content, link string)
- func (report *Report) Font(fontName string, size int, style string)
- func (report *Report) GetAllPageNum() int
- func (report *Report) GetAtomicCells() *[]string
- func (report *Report) GetBytesPdf() (ret []byte)
- func (report *Report) GetConfig() Config
- func (report *Report) GetContentWidthAndHeight() (width, height float64)
- func (report *Report) GetCurrentPageNo() int
- func (report *Report) GetPageEndXY() (x, y float64)
- func (report *Report) GetPageStartXY() (x, y float64)
- func (report *Report) GetXY() (x, y float64)
- func (report *Report) Image(path string, x1 float64, y1 float64, x2 float64, y2 float64)
- func (report *Report) InternalLinkAnchor(x, y, th float64, content, anchor string)
- func (report *Report) InternalLinkLink(x, y float64, content, anchor string)
- func (report *Report) Line(x1 float64, y1 float64, x2 float64, y2 float64)
- func (report *Report) LineColor(red int, green int, blue int)
- func (report *Report) LineDefaultColor()
- func (report *Report) LineGrayColor(x, y float64, w, h float64, gray float64)
- func (report *Report) LineH(x1 float64, y float64, x2 float64)
- func (report *Report) LineType(ltype string, width float64)
- func (report *Report) LineV(x float64, y1 float64, y2 float64)
- func (report *Report) LoadCellsFromText(filepath string) error
- func (report *Report) MeasureTextWidth(text string) float64
- func (report *Report) NoCompression()
- func (report *Report) Oval(x1 float64, y1 float64, x2 float64, y2 float64)
- func (report *Report) Rect(x1 float64, y1 float64, x2 float64, y2 float64)
- func (report *Report) RegisterExecutor(execuror Executor, name string)
- func (report *Report) SaveAtomicCellText(filepath string)
- func (report *Report) SetFont(family string, size int)
- func (report *Report) SetFontWithStyle(family, style string, size int)
- func (report *Report) SetFonts(fmap []*FontMap)
- func (report *Report) SetMargin(dx, dy float64)
- func (report *Report) SetPage(size string, orientation string)
- func (report *Report) SetXY(currX, currY float64)
- func (report *Report) TextColor(red int, green int, blue int)
- func (report *Report) TextDefaultColor()
- func (report *Report) Var(name string, val string)
- type Scope
Constants ¶
const ( Header = "Header" Detail = "Detail" // flags FlagAutoAddNewPage = "AutoAddNewPage" FlagResetPageNo = "ResetPageNo" )
需要解决的问题: currY的控制权, 用户 -> 程序 -> 自动化操作 页面的三部分: Header Page Footer
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
单位像素
func (*Config) GetWidthAndHeight ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
对接 pdf
func (*Converter) BackgroundColor ¶
func (*Converter) Cell ¶
单元格 ["C", family, size, x, y, content] // 从(x,y) 位置开始写入content ["CL", x, y, content] // 从(x,y) 位置开始写入content ["CR", x, y, w, content] // 从右往左写入w长度的内容
func (*Converter) CompressLevel ¶
func (*Converter) ExternalLink ¶
外部链接 ["EL", x, y, w, h, content, link] // 从(x,y)开始写入content,并添加外链接
func (*Converter) Font ¶
设置当前文本使用的字体 ["", "family", "style", "size"] style: "" or "U", ("B", "I")(需要字体本身支持)
func (*Converter) GetAutomicCells ¶
获取AtomicCells
func (*Converter) GetBytesPdf ¶
func (*Converter) InternalLinkAnchor ¶
内部链接, 锚点 ["ILA", x, y, w, h, content, anchor]
func (*Converter) InternalLinkLink ¶
内部链接, 链接 ["ILL", x, y, w content, anchor]
func (*Converter) Line ¶
线 ["L", x1, y1, x2, y2] 两点之间的线 ["LH", x1, y1, x2] 水平线 ["LV", x1, y2, y2] 垂直线 ["LT", "dashed|dotted|straight", w] 虚线,点,直线
func (*Converter) MeasureTextWidth ¶
func (*Converter) NoCompression ¶
func (convert *Converter) NoCompression()
func (*Converter) Page ¶
PDF文件页面的开始 [P, mm|pt|in, A4, P|L] mm|pt|in 表示的尺寸单位, 毫米,像素,英尺 P|L 表示Portait, Landscape, 表示布局
func (*Converter) SetAutomicCells ¶
设置AtomicCells(小心使用)
type List ¶
type List struct {
// contains filtered or unexported fields
}
func (*List) GetAsArray ¶
func (list *List) GetAsArray() []interface{}
type Report ¶
type Report struct { FisrtPageNeedHeader bool // 首页需要执行页眉 Vars map[string]string // contains filtered or unexported fields }
func CreateReport ¶
func CreateReport() *Report
func (*Report) AddCallBack ¶
func (*Report) BackgroundColor ¶
color: 背景颜色 line: 是否需要边框线条, "0000"不需要, "1111"需要, "0110" 是需要 TOP,RIGHT 线条
func (*Report) CompressLevel ¶
*************************************************************** 压缩级别:
-2 只使用哈夫曼压缩, -1 默认值, 压缩级别的6 0 不进行压缩, 1 最快的压缩, 但是压缩比率不是最好的 9 最大限度的压缩, 但是执行效率也是最慢的
***************************************************************
func (*Report) ExternalLink ¶
外部链接
func (*Report) GetContentWidthAndHeight ¶
func (*Report) GetPageEndXY ¶
func (*Report) GetPageStartXY ¶
func (*Report) InternalLinkAnchor ¶
func (*Report) InternalLinkLink ¶
func (*Report) LineDefaultColor ¶
func (report *Report) LineDefaultColor()
func (*Report) LineGrayColor ¶
线条灰度
func (*Report) LoadCellsFromText ¶
func (*Report) MeasureTextWidth ¶
计算文本宽度, 必须先调用 SetFontWithStyle() 或者 SetFont()
func (*Report) NoCompression ¶
func (report *Report) NoCompression()
func (*Report) RegisterExecutor ¶
func (*Report) SaveAtomicCellText ¶
保存原子操作单元
func (*Report) SetFontWithStyle ¶
设置当前文本字体, 先注册,后设置
type Scope ¶
当作为Margin的时候, Right无法生效 当作为Border的时候, Bottom无法生效
func (*Scope) ReplaceBorder ¶
func (scope *Scope) ReplaceBorder()
func (*Scope) ReplaceMarign ¶
func (scope *Scope) ReplaceMarign()