summaryrefslogtreecommitdiff
path: root/xmlStyles.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-03-10 00:04:23 +0800
committerxuri <xuri.me@gmail.com>2020-03-10 00:04:23 +0800
commit9e2318cefa4ebaa7bf6b1dbc95b30ad7a32366b1 (patch)
tree5662b564bb64068e0f60f1ade1dd5679f9df3974 /xmlStyles.go
parent2ccb8f62edd5d1ce039e663591964b9066fd2f4e (diff)
Resolve #470, export Style structs to allow create the style for cells by given JSON or structure
Diffstat (limited to 'xmlStyles.go')
-rw-r--r--xmlStyles.go84
1 files changed, 48 insertions, 36 deletions
diff --git a/xmlStyles.go b/xmlStyles.go
index 0313008..d6aa4f9 100644
--- a/xmlStyles.go
+++ b/xmlStyles.go
@@ -313,8 +313,28 @@ type xlsxStyleColors struct {
Color string `xml:",innerxml"`
}
-// formatFont directly maps the styles settings of the fonts.
-type formatFont struct {
+// Alignment directly maps the alignment settings of the cells.
+type Alignment struct {
+ Horizontal string `json:"horizontal"`
+ Indent int `json:"indent"`
+ JustifyLastLine bool `json:"justify_last_line"`
+ ReadingOrder uint64 `json:"reading_order"`
+ RelativeIndent int `json:"relative_indent"`
+ ShrinkToFit bool `json:"shrink_to_fit"`
+ TextRotation int `json:"text_rotation"`
+ Vertical string `json:"vertical"`
+ WrapText bool `json:"wrap_text"`
+}
+
+// Border directly maps the border settings of the cells.
+type Border struct {
+ Type string `json:"type"`
+ Color string `json:"color"`
+ Style int `json:"style"`
+}
+
+// Font directly maps the font settings of the fonts.
+type Font struct {
Bold bool `json:"bold"`
Italic bool `json:"italic"`
Underline string `json:"underline"`
@@ -324,38 +344,30 @@ type formatFont struct {
Color string `json:"color"`
}
-// formatStyle directly maps the styles settings of the cells.
-type formatStyle struct {
- Border []struct {
- Type string `json:"type"`
- Color string `json:"color"`
- Style int `json:"style"`
- } `json:"border"`
- Fill struct {
- Type string `json:"type"`
- Pattern int `json:"pattern"`
- Color []string `json:"color"`
- Shading int `json:"shading"`
- } `json:"fill"`
- Font *formatFont `json:"font"`
- Alignment *struct {
- Horizontal string `json:"horizontal"`
- Indent int `json:"indent"`
- JustifyLastLine bool `json:"justify_last_line"`
- ReadingOrder uint64 `json:"reading_order"`
- RelativeIndent int `json:"relative_indent"`
- ShrinkToFit bool `json:"shrink_to_fit"`
- TextRotation int `json:"text_rotation"`
- Vertical string `json:"vertical"`
- WrapText bool `json:"wrap_text"`
- } `json:"alignment"`
- Protection *struct {
- Hidden bool `json:"hidden"`
- Locked bool `json:"locked"`
- } `json:"protection"`
- NumFmt int `json:"number_format"`
- DecimalPlaces int `json:"decimal_places"`
- CustomNumFmt *string `json:"custom_number_format"`
- Lang string `json:"lang"`
- NegRed bool `json:"negred"`
+// Fill directly maps the fill settings of the cells.
+type Fill struct {
+ Type string `json:"type"`
+ Pattern int `json:"pattern"`
+ Color []string `json:"color"`
+ Shading int `json:"shading"`
+}
+
+// Protection directly maps the protection settings of the cells.
+type Protection struct {
+ Hidden bool `json:"hidden"`
+ Locked bool `json:"locked"`
+}
+
+// Style directly maps the style settings of the cells.
+type Style struct {
+ Border []Border `json:"border"`
+ Fill Fill `json:"fill"`
+ Font *Font `json:"font"`
+ Alignment *Alignment `json:"alignment"`
+ Protection *Protection `json:"protection"`
+ NumFmt int `json:"number_format"`
+ DecimalPlaces int `json:"decimal_places"`
+ CustomNumFmt *string `json:"custom_number_format"`
+ Lang string `json:"lang"`
+ NegRed bool `json:"negred"`
}