HomeUniDoc
...

Package convertutils

Overview ▾

Index ▾

Constants
Variables
func AdjustColor(colorStr string, EG_ColorTransform []*dml.EG_ColorTransform) string
func AdjustColorByLumMod(colorStr string, lum float64) string
func AdjustColorByShade(colorStr string, shade float64) string
func AdjustColorByTint(colorStr string, tint float64) string
func AssignStdFontByName(style creator.TextStyle, fontName string) *model.PdfFont
func CropImageByRect(sourceImg image.Image, rect image.Rectangle) image.Image
func DrawLine(c *creator.Creator, x0, y0, x1, y1, width float64, color creator.Color)
func DrawRectangle(c *creator.Creator, r *Rectangle, w float64, color creator.Color)
func FromSTCoordinate(st dml.ST_Coordinate) int64
func FromSTCoordinate32(st dml.ST_Coordinate32) int64
func FromSTPercentage(st *dml.ST_Percentage) float64
func GetColorStringFromDmlColor(dmlColor *dml.CT_Color) string
func GetDataFromXfrm(xfrm *dml.CT_Transform2D) (float64, float64, float64, float64)
func GetImage(c *creator.Creator, goImg image.Image, imgHeight, imgWidth, left, top, dividerX, dividerY float64, part ImgPart) (*creator.Image, error)
func GetOpacityFromColorTransform(trs []*dml.EG_ColorTransform) float64
func GetPageFromCreator(c *creator.Creator) (*model.PdfPage, error)
func GetRegisteredFont(name string, style FontStyle) *model.PdfFont
func IsNoSpaceLanguage(symbol string) bool
func Lighten(clr float64) float64
func MakeBlockFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme) (*creator.Block, error)
func MakeBlockFromCreator(c *creator.Creator) (*creator.Block, error)
func MakeImageFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme) (image.Image, error)
func MakeTempCreator(width, height float64) *creator.Creator
func PointsFromTwips(twips int64) float64
func RegisterFont(name string, style FontStyle, font *model.PdfFont)
func RegisterFontsFromDirectory(dirName string) error
func TwipsFromPoints(points float64) float64
type BorderPosition
type FontStyle
    func (fs FontStyle) String() string
type ImgPart
type Rectangle
    func (r *Rectangle) Translate(x, y float64)

Package files

bar_chart.go chart.go chart_axis.go color.go fonts.go utils.go

Constants

const DefaultFontSize = 12.0 // the height of font sized 12 points which is the default font size for Word and Excel.

Variables

var StdFontsMap = map[string][]string{
    "Helvetica": []string{
        "Helvetica",
        "Helvetica-Bold",
        "Helvetica-Oblique",
        "Helvetica-BoldOblique",
    },
    "Courier": []string{
        "Courier",
        "Courier-Bold",
        "Courier-Oblique",
        "Courier-BoldOblique",
    },
    "Times New Roman": []string{
        "Times-Roman",
        "Times-Bold",
        "Times-Italic",
        "Times-BoldItalic",
    },
    "default": []string{
        "Helvetica",
        "Helvetica-Bold",
        "Helvetica-Oblique",
        "Helvetica-BoldOblique",
    },
}

func AdjustColor

func AdjustColor(colorStr string, EG_ColorTransform []*dml.EG_ColorTransform) string

AdjustColor adjusts a color represented by a hexadecimal string with a given array of transform values.

func AdjustColorByLumMod

func AdjustColorByLumMod(colorStr string, lum float64) string

AdjustColorByLumMod adjusts a color represented by a hexadecimal string with a given luminance modulation.

func AdjustColorByShade

func AdjustColorByShade(colorStr string, shade float64) string

AdjustColorByShade adjusts a color represented by a hexadecimal string with a given shade.

func AdjustColorByTint

func AdjustColorByTint(colorStr string, tint float64) string

AdjustColorByTint adjusts a color represented by a hexadecimal string with a given tint.

func AssignStdFontByName

func AssignStdFontByName(style creator.TextStyle, fontName string) *model.PdfFont

func CropImageByRect

func CropImageByRect(sourceImg image.Image, rect image.Rectangle) image.Image

func DrawLine

func DrawLine(c *creator.Creator, x0, y0, x1, y1, width float64, color creator.Color)

DrawLine draws a line with given coordinates, width and color.

func DrawRectangle

func DrawRectangle(c *creator.Creator, r *Rectangle, w float64, color creator.Color)

DrawRectangle draws a rectangle with given coordinates, width and color.

func FromSTCoordinate

func FromSTCoordinate(st dml.ST_Coordinate) int64

FromSTCoordinate returns an int64 value from dml.ST_Coordinate or 0 in the case of nil.

func FromSTCoordinate32

func FromSTCoordinate32(st dml.ST_Coordinate32) int64

FromSTCoordinate32 returns an int64 value from dml.ST_Coordinate32 or 0 in the case of nil.

func FromSTPercentage

func FromSTPercentage(st *dml.ST_Percentage) float64

func GetColorStringFromDmlColor

func GetColorStringFromDmlColor(dmlColor *dml.CT_Color) string

GetColorStringFromDmlColor returns a hexadecimal string representation of dml.CT_Color in the 'rgb' format.

func GetDataFromXfrm

func GetDataFromXfrm(xfrm *dml.CT_Transform2D) (float64, float64, float64, float64)

func GetImage

func GetImage(c *creator.Creator, goImg image.Image, imgHeight, imgWidth, left, top, dividerX, dividerY float64, part ImgPart) (*creator.Image, error)

func GetOpacityFromColorTransform

func GetOpacityFromColorTransform(trs []*dml.EG_ColorTransform) float64

func GetPageFromCreator

func GetPageFromCreator(c *creator.Creator) (*model.PdfPage, error)

func GetRegisteredFont

func GetRegisteredFont(name string, style FontStyle) *model.PdfFont

func IsNoSpaceLanguage

func IsNoSpaceLanguage(symbol string) bool

func Lighten

func Lighten(clr float64) float64

Lighten makes a r, g or b channel value lighter by 40% for getting colors of headers and footers.

func MakeBlockFromChartSpace

func MakeBlockFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme) (*creator.Block, error)

MakeBlockFromChartSpace makes creator.Block from the chart space.

func MakeBlockFromCreator

func MakeBlockFromCreator(c *creator.Creator) (*creator.Block, error)

MakeBlockFromCreator makes a creator.Block from the first page of a creator.

func MakeImageFromChartSpace

func MakeImageFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme) (image.Image, error)

MakeBlockFromChartSpace renders a Go image from the chart space.

func MakeTempCreator

func MakeTempCreator(width, height float64) *creator.Creator

MakeTempCreator returns a creator.Creator with a given width and height in millimeters.

func PointsFromTwips

func PointsFromTwips(twips int64) float64

PointsFromTwips converts twips to points.

func RegisterFont

func RegisterFont(name string, style FontStyle, font *model.PdfFont)

RegisterFont makes a PdfFont accessible for using in converting to PDF.

func RegisterFontsFromDirectory

func RegisterFontsFromDirectory(dirName string) error

RegisterFontsFromDirectory registers all fonts from the given directory automatically detecting font families and styles.

func TwipsFromPoints

func TwipsFromPoints(points float64) float64

TwipsFromPoints converts points to twips.

type BorderPosition

type BorderPosition byte
const (
    BorderPositionTop    BorderPosition = 0
    BorderPositionLeft   BorderPosition = 1
    BorderPositionBottom BorderPosition = 2
    BorderPositionRight  BorderPosition = 3
)

type FontStyle

FontStyle represents a kind of font styling. It can be FontStyle_Regular, FontStyle_Bold, FontStyle_Italic and FontStyle_BoldItalic.

type FontStyle byte
const (
    FontStyle_Regular    FontStyle = 0
    FontStyle_Bold       FontStyle = 1
    FontStyle_Italic     FontStyle = 2
    FontStyle_BoldItalic FontStyle = 3
)

func (FontStyle) String

func (fs FontStyle) String() string

String returns a string representation of FontStyle for logging purposes.

type ImgPart

type ImgPart byte
const (
    ImgPart_whole ImgPart = 0
    ImgPart_t     ImgPart = 1
    ImgPart_b     ImgPart = 2
    ImgPart_l     ImgPart = 3
    ImgPart_r     ImgPart = 4
    ImgPart_lt    ImgPart = 5
    ImgPart_rt    ImgPart = 6
    ImgPart_lb    ImgPart = 7
    ImgPart_rb    ImgPart = 8
)

type Rectangle

Rectangle represents a rectangle with top, bottom, left and right float64 coordinates.

type Rectangle struct {
    Top    float64
    Bottom float64
    Left   float64
    Right  float64
}

func (*Rectangle) Translate

func (r *Rectangle) Translate(x, y float64)

Translate moves a rectangle by provided x and y, which can be positive or negative float64.