We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Manipulate named ranges and styles in .NET

Hi,

I just started using Aspose cells.It’s really useful.
I have some doubts in using according to my flexibility.

I need to provide name to cells(headings) which are not from my list objects

For example:

Style style = sheet2.Cells[“A1”].GetStyle();
style.Name = “Album Id Number”;
sheet2.Cells[“A1”].SetStyle(style);
sheet2.Cells.ImportCustomObjects(otherAlbumDetails,new string[] { “Album Id”, “ReleaseDate”, “Title”, “Description” }, true, 0, 0, otherAlbumDetails.Count, true, “dd/mm/yyyy”, false);

Here if you notice I have cell with heading which is coming from object.When I export to excel,it is displaying as “AlbumId” instead of "Album Id Number"

How can I achieve this.I don’t want to show object names.Instead I need to provide proper names with spaces.

Also can I get cell as

Style style = sheet2.Cells[“AlbumId”].GetStyle(); instead of passing like A1,B1,A2,B2 etc.

I went through many posts but couldn’t find it.

Please help me.




Hi,

Thanks for providing us some details.

I think you are mixing the things. First of all, when you do process the code:

i.e.,

Style style = sheet2.Cells[“A1”].GetStyle();

style.Name = “Album Id Number”;

sheet2.Cells[“A1”].SetStyle(style);

it will instantiate a Style object (which you can only use to apply formattings) and set its name. It won’t create a named cell/range with the heading/title whatsoever. When you import your custom object to the worksheet cells, it won’t do anything or have any links with your style.

We recommend you to kindly go through the following document/ article completely on Named Ranges for your reference:
Using Named Ranges

Also, see the following documents for further reference on apply formattings and data importing options:
Data Formatting
Import Data into Worksheet

Hope, this helps a bit.

Thank you.