This is a migrated thread and some comments may be shown as answers.

GridViewSpreadStreamExport "External table is not in the expected format"

3 Answers 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arash
Top achievements
Rank 1
Veteran
Arash asked on 11 Mar 2021, 07:54 AM

Hi,

I don't know if this is the correct forum for this question but I couldn't find an Excel export/import forum which might be more suitable.

I'm using GridViewSpreadStreamExport to export RadGridViews to Excel which works fine and I can open the generated spreadsheet in Excel without any issues.

The issue comes when I try to open/read the generated spreadsheet in code using OleDbCommand with the following connection string:

@"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + path + "; Extended Properties = " + @"""Excel 12.0 Xml;HDR=YES;IMEX=1"";";

I get an "External table is not in the expected format" error message on opening the connection.

If I first open the generated spreadsheet in Excel and just save it, without making any changes to it,the issue does not occur and I can open the spreadsheet in code without any issues.

The spreadsheet does have multiple worksheets, each one from a new instance of a RadGridView, but I don't think that is the issue because generating a spreadsheet with a single worksheet has the same issue.

The RadGridView is in memory, not on the UI, and I just set some of the column headers, width and text alignments.

Export format is SpreadStreamExportFormat.Xlsx and the export of individual RadGridViews are done via:

spreadStreamExport.RunExport(path, new SpreadStreamExportRenderer());

Although I have tried not creating a new instance of SpreadStreamExportRenderer as well.

I've reduced the export to its bare minimum (removed column header and text alignment settings) but nothing has helped.

Any ideas what the issue could be?

Thanks,

Arash

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 12 Mar 2021, 10:20 AM

Hello Arash,

I was able to reproduce the observed issue. I have logged the issue on our feedback portal. You can track its progress, subscribe to status changes, and add your comment to it here. I have updated your Telerik points as well.

I cannot suggest a workaround for the issue. I wanted to ask you why you are importing the file this way? Why not use our library to import it? 

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Arash
Top achievements
Rank 1
Veteran
answered on 12 Mar 2021, 10:52 AM

Hi Dimitar,

 

Thanks for the feedback.

Main reason for use of OleDB in this case was code reuse.

But I may have to look into Telerik's library.

 

Regards,
Arash

0
Dimitar
Telerik team
answered on 12 Mar 2021, 11:39 AM

Hello Arash,

Ok, let me know if you have any further questions about the library.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Arash
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Arash
Top achievements
Rank 1
Veteran
Share this question
or