| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package xlsx
- import "strconv"
- // Style is a high level structure intended to provide user access to
- // the contents of Style within an XLSX file.
- type Style struct {
- Border Border
- Fill Fill
- Font Font
- }
- func NewStyle() *Style {
- return &Style{}
- }
- func (style *Style) makeXLSXStyleElements() (xFont xlsxFont, xFill xlsxFill, xBorder xlsxBorder, xCellStyleXf xlsxXf, xCellXf xlsxXf) {
- xFont = xlsxFont{}
- xFill = xlsxFill{}
- xBorder = xlsxBorder{}
- xCellStyleXf = xlsxXf{}
- xCellXf = xlsxXf{}
- xFont.Sz.Val = strconv.Itoa(style.Font.Size)
- xFont.Name.Val = style.Font.Name
- xFont.Family.Val = strconv.Itoa(style.Font.Family)
- xFont.Charset.Val = strconv.Itoa(style.Font.Charset)
- xPatternFill := xlsxPatternFill{}
- xPatternFill.PatternType = style.Fill.PatternType
- xPatternFill.FgColor.RGB = style.Fill.FgColor
- xPatternFill.BgColor.RGB = style.Fill.BgColor
- xFill.PatternFill = xPatternFill
- xBorder.Left = xlsxLine{Style: style.Border.Left}
- xBorder.Right = xlsxLine{Style: style.Border.Right}
- xBorder.Top = xlsxLine{Style: style.Border.Top}
- xBorder.Bottom = xlsxLine{Style: style.Border.Bottom}
- return
- }
- // Border is a high level structure intended to provide user access to
- // the contents of Border Style within an Sheet.
- type Border struct {
- Left string
- Right string
- Top string
- Bottom string
- }
- func NewBorder(left, right, top, bottom string) *Border {
- return &Border{Left: left, Right: right, Top: top, Bottom: bottom}
- }
- // Fill is a high level structure intended to provide user access to
- // the contents of background and foreground color index within an Sheet.
- type Fill struct {
- PatternType string
- BgColor string
- FgColor string
- }
- func NewFill(patternType, fgColor, bgColor string) *Fill {
- return &Fill{PatternType: patternType, FgColor: fgColor, BgColor: bgColor}
- }
- type Font struct {
- Size int
- Name string
- Family int
- Charset int
- }
- func NewFont(size int, name string) *Font {
- return &Font{Size: size, Name: name}
- }
|