DataTableFormatProvider

2 Answers 243 Views
General Discussion
Serge
Top achievements
Rank 1
Iron
Serge asked on 16 Jun 2021, 10:40 AM

Hello,

I'm actually building an app in UWP which has for objective to convert a xls(x) file into a sécurisé pdf file. To make that conversion, one of the step I need (and made) was the conversion from a RaadSpreadsheet.Workbook into a DataTable via the wonderful tool you provide, DataTableFormatProvider.Export()

It does wonder until I was recently given a sample xls with some filter in it. And during the conversion, I've received an error concerning the wrong datatype (ListDictionaryInternal) in place of string. I understand where the error come from and I understand that I just need to get rid of theses excel filter (or to ignore them during conversion but I was unable to find how.

Right now, I'm thinking about converting by myself each spreadsheet row/cell into datatable row/cell one by one but I still want to know if there is an option to the formatage to ignore this type of data ?

Or maybe is there a way to delete/clear theses ListDictionaryInternal from the spreadsheet ? (btw, I've tried deleting the row but it seems like the filter is pasted onto the document even if it is not visible)

 

I would appreciate any help. Thank in advance :)

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 21 Jun 2021, 06:39 AM

Hi Serge,

I was not able to reproduce the exception. I have attached my test project with a sample file with a filter. Can you please check it and let me know what I need to change in order to reproduce this?

A possible workaround is to set the  ShouldSetDataTypes property to false and you would not get the exception:

DataTableFormatProvider provider = new DataTableFormatProvider();
provider.ExportSettings.ShouldSetDataTypes = false;

Or you can remove the filters

workbook.Worksheets[0].Filter.ClearFilters();

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Serge
Top achievements
Rank 1
Iron
answered on 28 Jun 2021, 10:58 AM

Hey Dimitar,

 

Thanks for the answer, using the File.ReadAllBytes along with Filter.ClearFilters() and ShouldD worked perfectly.

 

 

Tags
General Discussion
Asked by
Serge
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Serge
Top achievements
Rank 1
Iron
Share this question
or