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

excelml export number format

1 Answer 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Albert Shenker asked on 23 Aug 2011, 03:05 PM
I have a grid with a column that is bound to a text field. This text is usually a number, but is sometimes a "-" character.

When exporting to Excel, I would like for the numbers to display with a single digit after the decimal point. So integers are displayed as #.0... (100.0 for example). I have the following style declaration:

Dim pctStyle As New Telerik.Web.UI.GridExcelBuilder.StyleElement("PctStyle")
pctStyle.AlignmentElement.HorizontalAlignment = GridExcelBuilder.HorizontalAlignmentType.Right
pctStyle.NumberFormat.FormatType = GridExcelBuilder.NumberFormatType.GeneralNumber
pctStyle.NumberFormat.Attributes("ss:Format") = "0.0"


It doesn't seem to work. The exported Excel file always shows 100 as 100, not 100.0.

I am wondering if this is because the underlying grid column data field is text? Is there any way to format the numeric output of a grid column that isn't bound to a numeric field?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Aug 2011, 05:04 AM
Hello Albert,

In order to customize the number in exported excel, you can use the mso-number-format style attribute. Check the following help documentation which explains more about this.
Word/Excel export (HTML-based).

Thanks,
Princy.
Tags
Grid
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Answers by
Princy
Top achievements
Rank 2
Share this question
or