mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00

* MATCH, IFS, MAXA, MINA * OFFSET fixed * ISBLANK, ISERR, ISERROR, ISEVEN ,ISFORMULA, ISNONTEXT, ISNUMBER, ISODD, ISTEXT * ISLEAPYEAR, ISLOGICAL, ISNA, ISREF * FIND, FINDB * SEARCH, SEARCHB * CONCAT, CONCATENATE * YEAR, YEARFRAC * CONCAT is fixed, now TRUE and FALSE are concatenated instead of 1 and 0 in case of boolean results * NOW, TODAY, TIME, TIMEVALUE * DATE * DATEDIF
97 lines
2.5 KiB
Go
97 lines
2.5 KiB
Go
// Copyright 2017 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by the terms of the Affero GNU General
|
|
// Public License version 3.0 as published by the Free Software Foundation and
|
|
// appearing in the file LICENSE included in the packaging of this file. A
|
|
// commercial license can be purchased on https://unidoc.io.
|
|
|
|
package spreadsheet
|
|
|
|
import (
|
|
"github.com/unidoc/unioffice"
|
|
"github.com/unidoc/unioffice/color"
|
|
"github.com/unidoc/unioffice/schema/soo/sml"
|
|
)
|
|
|
|
// Border is a cell border configuraton.
|
|
type Border struct {
|
|
x *sml.CT_Border
|
|
borders *sml.CT_Borders
|
|
}
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (b Border) X() *sml.CT_Border {
|
|
return b.x
|
|
}
|
|
|
|
// InitializeDefaults initializes a border to its defaulte empty values.
|
|
func (b Border) InitializeDefaults() {
|
|
b.x.Left = sml.NewCT_BorderPr()
|
|
b.x.Bottom = sml.NewCT_BorderPr()
|
|
b.x.Right = sml.NewCT_BorderPr()
|
|
b.x.Top = sml.NewCT_BorderPr()
|
|
b.x.Diagonal = sml.NewCT_BorderPr()
|
|
}
|
|
|
|
// Index returns the index of the border for use with a cell style.
|
|
func (b Border) Index() uint32 {
|
|
for i, bx := range b.borders.Border {
|
|
if bx == b.x {
|
|
return uint32(i)
|
|
}
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (b Border) SetLeft(style sml.ST_BorderStyle, c color.Color) {
|
|
if b.x.Left == nil {
|
|
b.x.Left = sml.NewCT_BorderPr()
|
|
}
|
|
b.x.Left.Color = sml.NewCT_Color()
|
|
b.x.Left.Color.RgbAttr = c.AsRGBAString()
|
|
b.x.Left.StyleAttr = style
|
|
}
|
|
|
|
func (b Border) SetRight(style sml.ST_BorderStyle, c color.Color) {
|
|
if b.x.Right == nil {
|
|
b.x.Right = sml.NewCT_BorderPr()
|
|
}
|
|
b.x.Right.Color = sml.NewCT_Color()
|
|
b.x.Right.Color.RgbAttr = c.AsRGBAString()
|
|
b.x.Right.StyleAttr = style
|
|
}
|
|
|
|
func (b Border) SetTop(style sml.ST_BorderStyle, c color.Color) {
|
|
if b.x.Top == nil {
|
|
b.x.Top = sml.NewCT_BorderPr()
|
|
}
|
|
b.x.Top.Color = sml.NewCT_Color()
|
|
b.x.Top.Color.RgbAttr = c.AsRGBAString()
|
|
b.x.Top.StyleAttr = style
|
|
}
|
|
|
|
func (b Border) SetBottom(style sml.ST_BorderStyle, c color.Color) {
|
|
if b.x.Bottom == nil {
|
|
b.x.Bottom = sml.NewCT_BorderPr()
|
|
}
|
|
b.x.Bottom.Color = sml.NewCT_Color()
|
|
b.x.Bottom.Color.RgbAttr = c.AsRGBAString()
|
|
b.x.Bottom.StyleAttr = style
|
|
}
|
|
|
|
func (b Border) SetDiagonal(style sml.ST_BorderStyle, c color.Color, up, down bool) {
|
|
if b.x.Diagonal == nil {
|
|
b.x.Diagonal = sml.NewCT_BorderPr()
|
|
}
|
|
b.x.Diagonal.Color = sml.NewCT_Color()
|
|
b.x.Diagonal.Color.RgbAttr = c.AsRGBAString()
|
|
b.x.Diagonal.StyleAttr = style
|
|
|
|
if up {
|
|
b.x.DiagonalUpAttr = unioffice.Bool(true)
|
|
}
|
|
if down {
|
|
b.x.DiagonalDownAttr = unioffice.Bool(true)
|
|
}
|
|
}
|