excelize
excelize copied to clipboard
Excelize should have GetColStyle and GetRowStyle
Description
SetColStyle
and SetRowStyle
exist but there is no equivalent read method to read a column/row's style. Ideally this would return col/row styles without parsing the entire worksheet's XML (if that's possible?).
yes, that would allow to copy style from existing File and have a better designed output
This library supported getting row style ID by the GetRowOpts
function since version 2.6.1. For example, get the style ID of each row on Sheet1
:
rows, err := f.Rows("Sheet1")
if err != nil {
fmt.Println(err)
return
}
var rowNum int
for rows.Next() {
rowNum++
rowOpts := rows.GetRowOpts()
fmt.Printf("the style ID of row %d is %d\n", rowNum, rowOpts.StyleID)
}
if err = rows.Close(); err != nil {
fmt.Println(err)
}
I have added new a function GetColStyle
, now you can get the column style ID by it like this:
styleID, err := f.GetColStyle("Sheet1", "C")