We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to format cell's as text when input percentage data

I have a cell, its format is text, but when I input 100%, it changes to 1

any idea to set its format, no matter what data input, always is text type. I need the result is 100%, not 1.

Actually, If I set cell format as Text, this problem will disapear.

how to set a cell format to Text, and input 100%, still show as 100%, not 1


thanks.

Hi,


Please see the following sample code on how to specify “Text” number formatting applied to a cell for your reference:
e.g
Sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Aspose.Cells.Cell cell = worksheet.Cells[“A1”];
cell.PutValue(123);
Style style = cell.GetStyle();
style.Custom = “@”;
cell.SetStyle(style);
workbook.Save(“e:\test\out1.xls”);


Also, see the document on how to apply different numbers formattings to cells for your complete reference:
http://www.aspose.com/docs/display/cellsnet/Setting+Display+Formats+of+Numbers+and+Dates

Hope, this helps a bit.

Thank you.