Telerik Radgrid - I get and error when open excel file exported

0 Answers 29 Views
Grid
Sebastian
Top achievements
Rank 1
Sebastian asked on 15 Oct 2021, 04:54 PM

Hi Guys,

I tried to find a solution for this, but I can't do it.

I have a RadGrid

                <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowAutomaticUpdates="False" AllowMultiRowEdit="false" Width="100%" OnItemCreated="RadGrid1_ItemCreated" 
                    AllowSorting="True" DataSourceID="exampledatasource2" DataKeyNames="Example" AllowAutomaticDeletes="True"  OnItemCommand="RadGrid1_ItemCommand" CommandItemStyle-HorizontalAlign="Left" 
                    PageSize="30" OnPreRender="RadGrid1_PreRender">
                    <GroupingSettings CaseSensitive="false" />
                    <CommandItemStyle  CssClass="all" />
                    <ExportSettings IgnorePaging="true" ExportOnlyData="true" Excel-Format="Xlsx"></ExportSettings>
                    <MasterTableView AllowAutomaticDeletes="true" AutoGenerateColumns="False" EnableHeaderContextMenu="true" DataSourceID="exampledatasource2" AllowFilteringByColumn="True" EditMode="InPlace" DataKeyNames="Example" CommandItemSettings-ShowExportToExcelButton="True"  CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign="Left" CommandItemSettings-ExportToExcelImageUrl="../images/icons/excel.gif">
                        <CommandItemSettings ExportToPdfText="Export to Pdf" ShowExportToExcelButton="True" ShowAddNewRecordButton="false"></CommandItemSettings>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

 

but when I try to open the excel file, I get 2 alert windows:

1- 

We encountered a problem with content "RadgridExport (44) .xlsx" Do you want us to try to retrieve as much content as possible? If you trust the source of this book, click Yes

 

After click "Yes", I get this:

2-

"Excel has completed file-level validation and repair. Parts of this book may have been repaired or discarded.
Repaired records: Format of /xl/styles.xml part (Styles)"

 

This gives me problems, since in some cells (not all) the date format changes, the correct format is "dd/mm/YYYY", but some cells have the format "mm/dd/YYYY":

 

 

It is not a problem with the records in the database, as the data is fine. This is very strange since the formatting problem does not always occur.

I exported this excel several times and on the fifth try the dates were fine, although it still shows the 2 alert messages.

 

 

Any suggestions for this problem? Thanks in advanced.

 

Attila Antal
Telerik team
commented on 20 Oct 2021, 11:29 AM

Hi Sebastian. I would need to see the complete implementation from the Markup and Code-Behind to have a better understanding and be able to replicate the issue eventually. 

Overall I need to understand how the Columns are formatted, what is happening in the "RadGrid1_ItemCommand" event, and any other code that makes changes to RadGrid.

Also, can you show me how the Data looks like in every cell? Sometimes the data with special characters may result in the same problem.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Sebastian
Top achievements
Rank 1
Share this question
or