Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FgColor.Indexed got a wrong color from IndexedColorMapping #1521

Closed
zjfGH opened this issue Apr 13, 2023 · 2 comments · Fixed by #1574
Closed

FgColor.Indexed got a wrong color from IndexedColorMapping #1521

zjfGH opened this issue Apr 13, 2023 · 2 comments · Fixed by #1574
Projects

Comments

@zjfGH
Copy link

zjfGH commented Apr 13, 2023

f, _ := excelize.OpenFile("test.xlsx")
style, _ := f.GetCellStyle("Sheet1", "B2")
fillID := *f.Styles.CellXfs.Xf[style].FillID
fgColor := f.Styles.Fills.Fill[fillID].PatternFill.FgColor
fmt.Println(excelize.IndexedColorMapping[fgColor.Indexed])

expect: 499d73
actual: 800000


test.xlsx

@xuri
Copy link
Member

xuri commented Apr 13, 2023

Thanks for your issue. Their custom index colors are mapped in your attachment workbook, so you can't use the default excelize.IndexedColorMapping. Currently, the library doesn't support reading custom index colors. We plan to add get style definition support for this feature in the next version to resolve this problem, also reference issue #314.

@xuri xuri added the in progress Working in progress label May 15, 2023
@xuri xuri linked a pull request Aug 24, 2023 that will close this issue
10 tasks
xuri pushed a commit that referenced this issue Aug 24, 2023
- Add new function GetStyle support for get style definition
@xuri xuri removed the in progress Working in progress label Aug 24, 2023
@xuri xuri added this to Bugfix in v2.8.0 Aug 24, 2023
@xuri
Copy link
Member

xuri commented Aug 25, 2023

The new function GetStyle has been added. Now, we can get style index at first, and get the style definition with that. Please try to upgrade the master branch code. This feature will be released in the next version.

jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…x-os#1574)

- Add new function GetStyle support for get style definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v2.8.0
Bugfix
Development

Successfully merging a pull request may close this issue.

2 participants