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.

Thu Dec 23, 2010 1:35 am

Hello
Once I created an EXCEL workbook by using VB .NET and had fun into a problem. That is what can I do to convert the Cell number format to Text from General in VB .NET.

THANKS
Ted

ted
 
Posts: 7
Joined: Tue Dec 21, 2010 9:01 am

Thu Dec 23, 2010 5:18 am

Thank you for your inquriy.
You can try these codes below:
Spire.Xls.Workbook workbook = new Spire.Xls.Workbook();
Spire.Xls.Worksheet worksheet = workbook.Worksheets[0];
worksheet.Range["A1"].Value = "123";
worksheet.Range["A2"].Value = "123";
worksheet.Range["A2"].NumberFormat = "@";
workbook.SaveToFile("test.xls");

In these codes, A1 is a General format; A2 is a Text format.
Best Regards
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.XLS