excelize icon indicating copy to clipboard operation
excelize copied to clipboard

get style details

Open shaunc opened this issue 6 years ago • 8 comments

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```

shaunc avatar Dec 20 '18 15:12 shaunc

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 avatar Dec 21 '18 05:12 dayfine

@dayfine The point of this issue is that there is no API to retrieve the style definition from a style ID retrieved with GetCellStyle.

dolmen avatar Jan 18 '19 14:01 dolmen

Can't find documentation how to get details about style by ID returned GetCellStyle.

kor44 avatar Mar 23 '20 14:03 kor44

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 avatar Mar 23 '20 15:03 xuri

@xuri thanks for answer.

kor44 avatar Mar 25 '20 16:03 kor44

Is there any plan to add this feature in the future? Would you be willing to accept a PR?

RobbieMcKinstry avatar Jun 25 '20 07:06 RobbieMcKinstry

I will consider adding support for this feature later. I'll certainly accept that patch if somebody did that.

xuri avatar Jun 25 '20 09:06 xuri

hi, @xuri I would like to implement this. Can give any guide on how to add or change any api.

Jonham avatar Jan 07 '22 00:01 Jonham

@Jonham Hello, do you have an API to get the style through the style ID?

xu123shuai456 avatar Apr 04 '23 05:04 xu123shuai456

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.

xuri avatar Apr 04 '23 05:04 xuri

I am also very excited for this feature, let us know if there is progress on that! And thank you for excellent library!

ernierasta avatar Apr 21 '23 04:04 ernierasta

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?

GoldenSheep402 avatar Apr 26 '23 01:04 GoldenSheep402

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.

xuri avatar Apr 26 '23 01:04 xuri

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. 我就死磕这一个项目,再开一个,不能投入大量精力,感觉大概率要陪跑

SingAurora avatar May 21 '23 09:05 SingAurora

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.

xuri avatar Aug 25 '23 02:08 xuri