Setting color of cell doesn't has any effect... #1559
Unanswered
Robert-M-Muench
asked this question in
Q&A
Replies: 1 comment
-
Hi @Robert-M-Muench, thanks for your feedback. Please check and make sure no errors in your code and custom-defined functions, such as package main
import (
"fmt"
"github.com/xuri/excelize/v2"
)
func main() {
f := excelize.NewFile()
defer func() {
// Close the spreadsheet.
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
styleIdx, err := f.NewStyle(&excelize.Style{
Fill: excelize.Fill{
Type: "pattern",
Color: []string{"A69276"},
Pattern: 1,
},
})
if err != nil {
fmt.Println(err)
return
}
if err = f.SetCellStyle("Sheet1", "A1", "B2", styleIdx); err != nil {
fmt.Println(err)
return
}
if err := f.SaveAs("Book1.xlsx"); err != nil {
fmt.Println(err)
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Well, the code is no rocket science but doesn't has any effect:
And then:
But no effect, and I don't have any clue what could be wrong...
Beta Was this translation helpful? Give feedback.
All reactions