Table: Convert To Range

Hi,


We are using Aspose.Cells for .net(6.0.).
We are actually using the Cells.ImportDataTable method to import the data table onto a work sheet.
Then we have created a list object for this ImportDataTable range and applied the TableStyleType to the range.
Now we want to convert the table to normal range as we do in the excel(.xlsx) file(which persists the style formatting of the table).
I was referring to the other thread (<a href="https://forum.aspose.com/t/119490) , but no use.
We have a client deliverable and stuck on this issue. We just want the same as it will happen on the excel sheet. Right click on table, Table->Convert to Range. That’s it.
Appreciate your quick help.


Thanks,
Pavan Kumar R

Hey Amzad,


I am waiting for your reply. We also have Aspose.Cells 7.1.2.
We actually badly need this functionality as we have a deliverable to client.
It will be very much helpful if you can answer this. I don’t see a method on the ListObject to UnList() it, like the VSTO provides one.

Thanks,
Pavan

Hi,


Please see the following sample code for your reference. I have used a template file that contains a Table (with style set) in the first worksheet. I simply used the following code to convert to simple range. The output file is also attached for your reference.

Sample code:

Workbook workbook = new Workbook(“e:\test2\Book_Table.xlsx”);
//Get the first table/list object.
ListObject listObject = workbook.Worksheets[0].ListObjects[0];
//Set the AutoFilters Off to make it normal.
listObject.AutoFilter.Range = null;

workbook.Save(“e:\test2\outtorange_Book.xlsx”);


By the way, since you are using some older version, so if it does not works well will your older version, you have to upgrade to latest version of the product which works absolutely fine with it: Aspose.Cells for .NET v7.3.1.3

Thank you.

Thanks for the reply, but sorry to say that didn’t solve my problem.

I could say, you have only removed the filters, but that result is still a table.
In the output file you sent, if you right click on the
any of the cell in the Table, then you see the Table->Convert to Range. If this is being converted to normal range then the Table property wouldn’t have shown.
I need to implement the same like Table->Convert To Range.

Thanks,
Pavan Kumar R

Actually if you could help with this that would be really a great help.


Thanks,
Pavan

Hi Pavan,


You are right it only eliminates auto-filters on the table/list object. I think it looks like a new feature that is not available in the product at the moment. I have logged your feature request into our database with an id: CELLSNET-41046. Please space us a little time. We will look into it soon.

Thank you.

Actually can you implement this feature and please let us know the timeframe for that. So we will plan accordingly.

Also meanwhile, if you can please let us know any work around for this. Like, how can we apply the TableStyleType like style to the RangeOfCells, so that instead of a ListObject creation, we can just apply the TableStyleTypeMedium17 kind of style the range of Cells in the excel file.

Thanks,

Pavan

Hi,


I have discussed your feature request with the concerned developer. After analysis, he will add a new method i.e., ListObject.AppleStyleToRange() for your needs. The new method would be included in the next fix that is due within 2-3 working days from now onward. See the sample code you might use with the fix (that we will provide it to you here):

Sample code:
Workbook wb = new Workbook(@“D:\FileTemp\book2.xlsx”);
wb.Worksheets[0].ListObjects[0].AppleStyleToRange();
wb.Worksheets[0].ListObjects.RemoveAt ; //You will also need this line to remove the table/references.
wb.Save(@“D:\FileTemp\dest.xlsx”);

Thank you.

Thank you for taking care of that.

However, I have find an alternate solution for this using Conditional Formatting and Alternate row shading. This will solve my problem of applying the TableStyle kind of format to the range of cells.

Thanks,

Pavan

Hi,

Thanks for using Aspose.Cells.

Please download and try this fix: Aspose.Cells for .NET v7.3.1.4 with the following sample code.

C#


Workbook wb = new Workbook(@“D:\FileTemp\book2.xlsx”);

//the following two lines work as converting table to range.

wb.Worksheets[0].ListObjects[0].AppleStyleToRange();

wb.Worksheets[0].ListObjects.RemoveAt(0) ;


wb.Save(@“D:\FileTemp\dest.xlsx”);


Thank you for taking care. It worked like a charm.

However, I feel the Methodname should be "ConvertToRange()", instead of

AppleStyleToRange().

Thanks,

Pavan Kumar R

Hi,


Well, the ApplyStyleToRange() method only copies the formatting upon data to the table range only, so you have to remove the table/list object in any case to implement the feature same as Excel. That’s why you have to use two lines:
e.g

wb.Worksheets[0].ListObjects[0].AppleStyleToRange();
wb.Worksheets[0].ListObjects.RemoveAt(0) ;


Thank you.

I got what you are saying, still I prefer to go with ConvertToRange() method name. However the method name you have provided "AppleStyleToRange()" has a spell mistake in it. it should be actually "ApplyStyleToRange()".

Thanks,

Pavan

rpk1926:

I got what you are saying, still I prefer to go with ConvertToRange() method name. However the method name you have provided "AppleStyleToRange()" has a spell mistake in it. it should be actually "ApplyStyleToRange()".

Thanks,

Pavan

Hi,

Thanks for mentioning this. We have noticed this issue. We will fix the spelling mistake in the Aspose.Cells for .NET dll.

Also, we will consider renaming as you suggested.

Hi,

Thanks for using Aspose.Cells.

We have fixed the issue of typo and added ListObject.ConvertToRange() method
too.

Please download and try this fix: Aspose.Cells for .NET v7.3.1.5 and let us know your feedback.

Thank you.

We have downloaded the dll and it is working fine.
Actually our Aspose.Total subscription was till June 2012. So do we need to re-new our subscription to use this new version.

Thanks,
Pavan

Hi,

Thanks for your feedback. It’s good to know that your issue is resolved with the latest fix.

Yes, since your subscription has expired, so you will have to renew it before you could use this new version in License mode.

For any questions relating to License Subscription or Renewal, please contact Aspose.Purchase department.


Aspose.Purchase team will help you asap.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.