Free Support Forum - aspose.com

How does one read the format category of a range?

Hi,


I am trying to figure out the format category of a range, e.g.: text, number, date, but am completely puzzled.

Have been looking at range[0,0].GetStyle(), range[0,0].GetDisplayStyle(), SharedStyleIndex, Workbook.GetStyleInPool(index)…but nothing seems to hold the information I am looking for.

Any help would be greatly appreciated.

I would really much like to just test like this:

- range.GetStyle().Category == FormatCategory.Number
- range.GetStyle().Category == FormatCategory.Text
- etc…

Kind regards,

Kris

Hi,

Thanks for your posting and using Aspose.Cells.

Could you please elaborate your requirements more with screenshots and sample files? We will look into your issue and help you asap.

Well I don’t think I can get any clearer with my requirement. I want to read out the data type that should be entered into a named range. I do not have an example for you.

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid, this feature is not available. You cannot read format category of Range object. For individual cell, you can try Style.Number or Style.Custom property.

Thanks for the prompt reply mshakeel.faiz.


What about range.GetCellOrNull(0,0).Style.Number / range[0,0].Style.Number? Would that be the style for the whole range? Merging means it becomes one cell visually, so there would be no reason for individual cell having different formatting.

I reckon I can use the list found at the following url to determine the format category?
http://www.aspose.com/docs/display/cellsnet/Setting+Display+Formats+of+Numbers++and++Dates

I also noticed that some of the styles in the document have really high numbers… e.g. 898 or 1431. These numbers obviously fall outside the range found on the above URL. Is there no way to determine the category other then using the range.GetCellOrNull(0,0).SharedStyleIndex and Workbook.GetStyleInPool(index)?

Kind regards,

Kris

Hi,

Thanks for your posting and using Aspose.Cells.

We have logged your issue in our database. We will look into your requirements and see its feasibility and advise you asap.

This issue has been logged as CELLSNET-41434.

Hi,

Thanks for using Aspose.Cells.

We could not support this feature. There is no such property in the
file.

If you want to get number format category, please use check
Style.Number and Style.Custom by yourself.

The issues you have found earlier (filed as CELLSNET-41434) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.