TableImage

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TableImageApi

type TableImageApi interface {

	/**
	初始化表格配置
	@param fontPath string [true] 指定字体文件路径
	@param rows string [true] 多少行
	@param columns string [true] 多少列
	*/
	InitTableImage(fontPath string, rows, columns int) error

	/**
	创建画布
	@return  返回画布的信息
	*/
	CreateImage() *TableImageClient

	/**
	设置图片标题
	@param title string [true] 图片标题
	@param mark string [true] 图片备注,一般写日期
	*/
	SetTitle(title, mark string) *TableImageClient

	/**
	生成表格
	@param dataTitle []TitleParse [true] 表格设置
	@param data []map[string]interface{} [true] 表格数据
	*/
	CreateTable(dataTitle []TitleParse, data []map[string]interface{}) *TableImageClient

	/**
	保存图片
	@param path string [true] 保存的路径
	*/
	SaveImage(path string)
}

func NewTableImageClient

func NewTableImageClient() TableImageApi

type TableImageClient

type TableImageClient struct {
	Conf   *TableImageConf //表格配置信息
	Dc     *gg.Context     //画布信息
	ImageW int             //画布宽
	ImageH int             //画布高
}

func (*TableImageClient) CreateImage

func (this *TableImageClient) CreateImage() *TableImageClient

* 创建画布 @return 返回画布的信息

func (*TableImageClient) CreateTable

func (this *TableImageClient) CreateTable(dataTitle []TitleParse, data []map[string]interface{}) *TableImageClient

* 生成表格 @param dataTitle []TitleParse [true] 表格设置 @param data []map[string]interface{} [true] 表格数据

func (*TableImageClient) InitTableImage

func (this *TableImageClient) InitTableImage(fontPath string, rows, columns int) error

* 初始化表格配置 @param fontPath string [true] 指定字体文件路径 @param rows string [true] 多少行 @param columns string [true] 多少列

func (*TableImageClient) SaveImage

func (this *TableImageClient) SaveImage(path string)

* 保存图片 @param path string [true] 保存的路径

func (*TableImageClient) SetTitle

func (this *TableImageClient) SetTitle(title, mark string) *TableImageClient

* 设置图片标题 @param title string [true] 图片标题 @param mark string [true] 图片备注,一般写日期

type TableImageConf

type TableImageConf struct {
	Margin         float64 //距离四周的边界值
	MarginTop      float64 //距离顶部的边界值
	Padding        int     //每个单元格的内边距
	FontPointTitle float64 //标题字体占用的像素点
	FontPointDate  float64 //日期字体占用的像素点
	OutLineWidth   float64 //外边框线条宽度
	InLineWidth    float64 //内边框线条宽度
	FontPath       string  //字体路径
	Rows           int     //多少行
	RowHight       float64 //行高
	Columns        int     //多少列
	ColumnWidth    float64 //列宽
}

* 表格配置

type TitleParse

type TitleParse struct {
	Field       string  //表格单元格字段
	Name        string  //表格单元格翻译名称
	ColumnWidth float64 //每列的宽度
}

* 表头翻译

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL