Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataTable records' datatype.

Status
Not open for further replies.

fiat2

Programmer
Nov 26, 2002
104
US
Using VS2005.
Using third party components(telerik) to display data on a webpage.
Using the ExportDataToExcel() to export to MS Excel.

When I export the data to the excel(2002) spreadsheet, all columns are displayed as Text rather than their datatype from the database.
When I watch the DataTable parameter, it's telling me its a Number, actually a decimal, but displayed as text in Excel.

Anyone have any ideas as to how to properly handle the datatypes for Excel?

Thanks.
 
try the telerik forums.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I had and this is the explanation they gave me:

"Unfortunately this feature is not supported. What in fact happens when you export to excel is that you have rendered html with response header type of excel, so that the excel recognize it as such. Therefore it is not possible to perform column formatting prior to the export action."


I sort-of understand this but I am having a hard time understanding why some columns are formatted properly but others are not.....

THnaks!
 
formatting excel is a different process then formatting a grid. therefore the process to render the workbook will most likely be seperate from the grid. (sometimes, for simple datadumps, it could be one to one, but you loose formatting.)

I use Carlos Ag Excel XML Writer to export data to excel. it's lightweight easy to use and free. It also does not require the excel interop assemblies. instead it generates the workbooks as xml.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top