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

[Solved] Exported Excel columns not same as on grid!

3 Answers 424 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deasun
Top achievements
Rank 1
Iron
Deasun asked on 05 Sep 2018, 07:16 PM

Good evening,

I have a number of integer columns that show up fine in the grid but after exporting to excel they appear with .00 at the end of them.

How do I make the exported doc look the same as the grid?

Example:

On the winforms grid value in cell  = 330249, and on the excel cell = 330249.00.

 

Thanks.

Deasun

3 Answers, 1 is accepted

Sort by
0
Deasun
Top achievements
Rank 1
Iron
answered on 05 Sep 2018, 07:25 PM

Forgot to say:

Telerik.WinControls.Export.GridViewSpreadExport spreadExporter = new Telerik.WinControls.Export.GridViewSpreadExport(this.gridNoIDX);
Telerik.WinControls.Export.SpreadExportRenderer exportRenderer = new Telerik.WinControls.Export.SpreadExportRenderer();

spreadExporter.ExportVisualSettings = true;

spreadExporter.RunExport(strPathToMyDocuments + @"\" + strFileName + ".xlsx", exportRenderer);

is how I am doing it.

0
Accepted
Dimitar
Telerik team
answered on 06 Sep 2018, 10:05 AM
Hello Deasun,

You can set the format manually. There are two properties on each column for this. Here is the code:
var col = radGridView1.Columns[0] as GridViewDecimalColumn;
col.ExcelExportType = Telerik.WinControls.UI.Export.DisplayFormatType.Custom;
col.ExcelExportFormatString = "#,##0";

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
George
Top achievements
Rank 1
commented on 11 Mar 2026, 02:38 PM

hello! I'm running through the same issue, using VB .NET

My code is as following:
 Dim columnPeople As New GridViewDecimalColumn("People", "People")
 columnPeople.DecimalPlaces = 0
 columnPeople.ExcelExportType = Telerik.WinControls.UI.Export.DisplayFormatType.Custom
 columnPeople.ExcelExportFormatString = "#,##0"
 columnPeople.MinWidth = 50
 columnPeople.Minimum = 0
 columnPeople.HeaderText = translate(language, "T_passenger", "PAX")
 columnPeople.Name = "People"
 columnPeople.ReadOnly = True
 columnPeople.AllowFiltering = False
 columnPeople.TextAlignment = ContentAlignment.MiddleRight
 If hiddenColumnsWithExtras.Contains(columnPeople.Name) Then
     columnPeople.IsVisible = False
 End If

But the solution doesn't seem to work. I still get something like 242,00 for example, in my excel export. Is there something that should be done differently in VB .NET?
Nadya | Tech Support Engineer
Telerik team
commented on 12 Mar 2026, 03:37 PM

Hello, George,

Thank you for sharing your code snippet.

Generally, there are no differences in the properties or methods used in C# and VB. The main difference lies in the syntax. Code that works in C# should also work in VB, as both languages use the same underlying .NET libraries.

I noticed that you also set columnPeople.DecimalPlaces property. Can you please remove it and test how it works then? 

0
Deasun
Top achievements
Rank 1
Iron
answered on 06 Sep 2018, 12:24 PM

Thanks.

went with: objGrid.Columns[intIDX].ExcelExportType = Telerik.WinControls.UI.Export.DisplayFormatType.None;

Have a function that loops thru the columns of the particular grid I send it. It checks the datatype and sets it to the correct export type.

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