Documentation
¶
Overview ¶
Package excel2pdf use excelize lib to read excel and gofpdf lib to write pdf. one sheet in excel will be one page in pdf.
Index ¶
- Constants
- func ConvertColWidthToPixels(width float64) float64
- func ConvertRowHeightToPixels(height float64) float64
- func CreatePdfElement(pdf *gopdf.GoPdf, cell string) error
- func DrawBorder(row, col int, border *excelize.Border, rowPos, colPos *[]float64, ...)
- func DrawPdfElement(pdf *gopdf.GoPdf, element *PdfElement)
- func DrawPdfLine(pdf *gopdf.GoPdf, element *PdfElement)
- func DrawPdfText(pdf *gopdf.GoPdf, element *PdfElement)
- func DrawSheetBorder(fe *excelize.File, sheetName string, maxCol, maxRow int, ...)
- func DrawSheetContent(fe *excelize.File, sheetName string, maxCol, maxRow int, ...)
- func DrawText(startRow, startCol, endRow, endCol int, text string, rowPos, colPos *[]float64, ...)
- func Excel2Pdf(fe *excelize.File, pdf *gopdf.GoPdf) error
- func GetCellPos(fe *excelize.File, sheetName string, maxCol, maxRow int) (*[]float64, *[]float64)
- func GetEndAxis(mergedCells []excelize.MergeCell, row, col int) (int, int)
- func GetXPos(line *PdfLine, horizontalAlign string, xPos, boxWidth float64) float64
- func GetYPos(pdfLines []PdfLine, verticalAlign string, yPos, boxHeight float64) float64
- func IsMergedCell(mergedCells []excelize.MergeCell, row, col int) bool
- func ProcessSheet(fe *excelize.File, sheetName string, pdf *gopdf.GoPdf) error
- type ElementColor
- type PdfElement
- type PdfLine
- type TextFont
Constants ¶
View Source
const ( BorderTypeLeft = "left" BorderTypeRight = "right" BorderTypeTop = "top" BorderTypeBottom = "bottom" )
View Source
const ( ElementTypeLine = "line" ElementTypeText = "text" )
View Source
const ( ElementAlignLeft = "left" ElementAlignCenter = "center" ElementAlignRight = "right" )
View Source
const ( VerticalAlignTop = "top" VerticalAlignMiddle = "center" VerticalAlignBottom = "bottom" )
Variables ¶
This section is empty.
Functions ¶
func ConvertColWidthToPixels ¶
func DrawBorder ¶
func DrawPdfElement ¶
func DrawPdfElement(pdf *gopdf.GoPdf, element *PdfElement)
func DrawPdfLine ¶
func DrawPdfLine(pdf *gopdf.GoPdf, element *PdfElement)
func DrawPdfText ¶
func DrawPdfText(pdf *gopdf.GoPdf, element *PdfElement)
func DrawSheetBorder ¶
func DrawSheetContent ¶
func GetCellPos ¶
Types ¶
type ElementColor ¶
type PdfElement ¶
type PdfElement struct {
Type string `json:"type,omitempty"`
Font *TextFont `json:"font,omitempty"`
Color *ElementColor `json:"color,omitempty"`
Rect [4]float64 `json:"rect,omitempty"`
Content string `json:"content,omitempty"`
Width float64 `json:"width,omitempty"`
LineHeight float64 `json:"lineHeight,omitempty"`
WordSpace float64 `json:"wordSpace,omitempty"`
MaxContentLength int `json:"maxContentLength,omitempty"`
VerticalAlign string `json:"verticalAlign,omitempty"`
HorizontalAlign string `json:"horizontalAlign,omitempty"`
Padding float64 `json:"padding,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.