I am trying to get .xlsx export to not give this warning shown below.
I am using a RadGrid that AutoGenerates columns. The RadGrid's culture is en-US. Need Data source gets a DataTable with one column and one row, with the value of -4.50. On ColumnCreated it makes the GridNumericColumn Currency type. The Grid displays the format properly. It also puts the value into excel as though it looks correct.
**The problem I currently see is that it is putting a line break after the value in excel. Not sure why this is happening with the export?
Example of code:
(.aspx file)
<div class="form-row mt-4">
<div class="col-md">
<div class="form-inline float-md-right">
<telerik:radajaxpanel runat="server" postbackcontrols="btnExportTest">
<asp:Button ID="btnExportTest" OnClick="btnExportTest_Click" runat="server" Text="Export" />
</telerik:radajaxpanel>
</div>
</div>
</div>
<div class="form-row mt-4">
<div class="col-md">
<telerik:RadGrid ID="Grid1" RenderMode="Lightweight" Skin="Bootstrap" runat="server" OnNeedDataSource="Grid1_NeedDataSource"
AllowFilteringByColumn="false" AllowPaging="false" AutoGenerateColumns="true" OnColumnCreated="Grid1_ColumnCreated">
</telerik:RadGrid>
</div>
</div>
(.cs)
protected void Grid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable table = new DataTable();
table.Columns.Add("currency", typeof(double));
table.Rows.Add("-4.50");
Grid1.DataSource = table;
}
protected void btnExportTest_Click(object sender, EventArgs e)
{
Grid1.ExportSettings.IgnorePaging = true;
Grid1.ExportSettings.FileName = "test";
Grid1.ExportSettings.ExportOnlyData = true;
Grid1.ExportSettings.OpenInNewWindow = true;
Grid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
Grid1.MasterTableView.ExportToExcel();
}
protected void Grid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
if (e.Column is GridNumericColumn)
{
((GridNumericColumn)e.Column).NumericType = NumericType.Currency;
}
}
I verified my windows settings are set up to show negative Currency with ($0.00).
This seems like it is just a problem with exporting from Telerik? Is there something that can make negative currencies export?
Currently using Q2 2021 Telerik version