Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

Mon May 05, 2008 11:54 am

Hello,

I have a DataTable with a "string" column (zipCode) with value "09510300". Using style.NumberFormat = "@" this column is exported with value like "9510300" of type number. How can I store the value "09510300" as a Text type without use style.NumberFormat="00000000" ?

Please send examples of style.NumberFormatLocal too.

Regards

newtoncd
 
Posts: 1
Joined: Mon May 05, 2008 11:24 am

Mon May 19, 2008 2:23 pm

Thank you for interesting our products.

1. You can set transTypes parameter to true when you call InsertDataTable method, so
it will preserve type when insert data into worksheet.
try to using following source code.
sheet.InsertDataTable((DataTable)this.dataGrid1.DataSource,true,2,1,-1,-1,true);

2. Numberformatlocal property can't be support in current release.
User avatar

Flash
 
Posts: 56
Joined: Thu Jun 29, 2006 2:34 pm

Return to Spire.XLS