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.
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”);
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
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.
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.
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.
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”);
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.
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:
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()".
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.