Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

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