diff options
author | jialei <31276367+MichealJl@users.noreply.github.com> | 2022-06-13 23:38:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 23:38:59 +0800 |
commit | d490a0f86f02f7f2eeabd8a0f38cbaa82a669187 (patch) | |
tree | 58dbcd42c8c33faa60bae10e606ab251dc8319c3 /cell.go | |
parent | d383f0ae6e253284520d10e574a01b0b904c91d9 (diff) |
RichTextRun support set superscript and subscript by vertAlign attribute (#1252)
check vertical align enumeration, update set rich text docs and test
Diffstat (limited to 'cell.go')
-rw-r--r-- | cell.go | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -848,7 +848,10 @@ func newRpr(fnt *Font) *xlsxRPr { if fnt.Family != "" { rpr.RFont = &attrValString{Val: &fnt.Family} } - if fnt.Size > 0.0 { + if inStrSlice([]string{"baseline", "superscript", "subscript"}, fnt.VertAlign, true) != -1 { + rpr.VertAlign = &attrValString{Val: &fnt.VertAlign} + } + if fnt.Size > 0 { rpr.Sz = &attrValFloat{Val: &fnt.Size} } if fnt.Color != "" { @@ -895,7 +898,7 @@ func newRpr(fnt *Font) *xlsxRPr { // }, // }, // { -// Text: " italic", +// Text: "italic ", // Font: &excelize.Font{ // Bold: true, // Color: "e83723", @@ -926,19 +929,34 @@ func newRpr(fnt *Font) *xlsxRPr { // }, // }, // { +// Text: " superscript", +// Font: &excelize.Font{ +// Color: "dbc21f", +// VertAlign: "superscript", +// }, +// }, +// { // Text: " and ", // Font: &excelize.Font{ -// Size: 14, -// Color: "ad23e8", +// Size: 14, +// Color: "ad23e8", +// VertAlign: "baseline", // }, // }, // { -// Text: "underline.", +// Text: "underline", // Font: &excelize.Font{ // Color: "23e833", // Underline: "single", // }, // }, +// { +// Text: " subscript.", +// Font: &excelize.Font{ +// Color: "017505", +// VertAlign: "subscript", +// }, +// }, // }); err != nil { // fmt.Println(err) // return |