excelize
excelize copied to clipboard
get style details
Description
Need api (or doc at least) on how to go from style number to attributes of style (such as color).
I am trying to get the color of a particular cell in a spreadsheet I am reading. I don't see how this is possible. There is a function that returns a handle to the style, but what to do with that number?
Describe the results you received:
Documentation has no information on how to get color from style.
Describe the results you expected:
Documentation would explain how to get color from style in terms of API details.
Output of go version:
go version go1.11.3 darwin/amd64
Excelize version or commit ID:
v1.4.0```
Is this an Excel issue or excelize issue? http://dmcritchie.mvps.org/excel/colors.htm
Would also be nice to name the API you tried to call....
@dayfine The point of this issue is that there is no API to retrieve the style definition from a style ID retrieved with GetCellStyle.
Can't find documentation how to get details about style by ID returned GetCellStyle.
Hi @kor44, the style ID return by GetCellStyle used for set other cells with the same style, this lib doesn't support to get cell style details currently, but the File.Style struct is helpful, you can parse it manually to get the style as you need, also reference this example: get cell background color.
@xuri thanks for answer.
Is there any plan to add this feature in the future? Would you be willing to accept a PR?
I will consider adding support for this feature later. I'll certainly accept that patch if somebody did that.
hi, @xuri I would like to implement this. Can give any guide on how to add or change any api.
@Jonham Hello, do you have an API to get the style through the style ID?
This feature has been working in progress (as a project of the Institute of Software Chinese Academy of Sciences 2023 Open Source Promotion Plan), the library will be supported to get style definitions by index in a future released version, in August, 2023.
I am also very excited for this feature, let us know if there is progress on that! And thank you for excellent library!
I’m quite interested in this feature. Does this mean giving the block which you want to get the style and then checking the form of the block and get the style by the form of the block? Or giving an area and get all the style including the area?
As the dolmen says:
The point of this issue is that there is no API to retrieve the style definition from a style ID retrieved with GetCellStyle.
This library needs a function for reading style definition details, the style is read in the style sheet through the given style ID and returns the complete style formats.
This feature has been working in progress (as a project of the Institute of Software Chinese Academy of Sciences 2023 Open Source Promotion Plan), the library will be supported to get style definitions by index in a future released version, in August, 2023.
I will put all my energy into this advanced project. Working on another project has a high probability of failure. 我就死磕这一个项目,再开一个,不能投入大量精力,感觉大概率要陪跑
The new function GetStyle has been added. Now, we can get style index at first, and then get the style definition with that. Please try to upgrade the master branch code. This feature will be released in the next version.