Hi There,
When I was trying to export an "number-like" text column, Excel (HTML) automatically treat it as a number.
For example: column "UserID" with data "000579" will be truncated to "579" in Excel.
Below are my functions. Is that any way to handle the cell format (force it to be TEXT) programmatically when it went to Excel?
Thanks in advance. :)
Regards,
waiwai
When I was trying to export an "number-like" text column, Excel (HTML) automatically treat it as a number.
For example: column "UserID" with data "000579" will be truncated to "579" in Excel.
Below are my functions. Is that any way to handle the cell format (force it to be TEXT) programmatically when it went to Excel?
' Add column to RadGrid1 Programmatically
Private
Sub
AddNewColumnToRadGrid(
ByVal
UniqueName
As
String
,
ByVal
HeaderText
As
String
,
ByVal
DataField
As
String
,
ByVal
SortExpression
As
String
)
Dim
boundColumn
As
New
GridBoundColumn()
RadGrid1.MasterTableView.Columns.Add(boundColumn)
boundColumn.UniqueName = UniqueName
boundColumn.HeaderText = HeaderText
If
DataField.Length > 0
Then
boundColumn.DataField = DataField
If
SortExpression.Length > 0
Then
boundColumn.SortExpression = SortExpression
End
Sub
' Simple Export to Excel Function
Protected
Sub
btnExportToExcel_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
btnExportToExcel.Click
RadGrid1.ExportSettings.FileName =
"Report"
RadGrid1.ExportSettings.ExportOnlyData =
True
RadGrid1.ExportSettings.IgnorePaging =
True
RadGrid1.ExportSettings.OpenInNewWindow =
True
RadGrid1.MasterTableView.ExportToExcel()
End
Sub
Thanks in advance. :)
Regards,
waiwai