mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +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
48 lines
1.2 KiB
Go
48 lines
1.2 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 document
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/unidoc/unioffice/color"
|
|
"github.com/unidoc/unioffice/schema/soo/wml"
|
|
)
|
|
|
|
// Color controls the run or styles color.
|
|
type Color struct {
|
|
x *wml.CT_Color
|
|
}
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (c Color) X() *wml.CT_Color {
|
|
return c.x
|
|
}
|
|
|
|
// SetColor sets a specific color or auto.
|
|
func (c Color) SetColor(v color.Color) {
|
|
if v.IsAuto() {
|
|
c.x.ValAttr.ST_HexColorAuto = wml.ST_HexColorAutoAuto
|
|
c.x.ValAttr.ST_HexColorRGB = nil
|
|
} else {
|
|
c.x.ValAttr.ST_HexColorAuto = wml.ST_HexColorAutoUnset
|
|
c.x.ValAttr.ST_HexColorRGB = v.AsRGBString()
|
|
}
|
|
}
|
|
|
|
// SetThemeColor sets the color from the theme.
|
|
func (c Color) SetThemeColor(t wml.ST_ThemeColor) {
|
|
c.x.ThemeColorAttr = t
|
|
}
|
|
|
|
// SetThemeShade sets the shade based off the theme color.
|
|
func (c Color) SetThemeShade(s uint8) {
|
|
shd := fmt.Sprintf("%02x", s)
|
|
c.x.ThemeShadeAttr = &shd
|
|
}
|