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

Free Support Forum - aspose.com

How to enter 17 digit number in cells

Hi All,

I have to insert a 17 digit number like 86113371280692223 in cells. but i am unable to get the required number.

i am getting number like this 86113371280692200.

I suppose that Aspose does not support a number more than 15 digits.

how to overcome this problem.

Please if any one can help me.

Thanks,

Hi,

Thank you for considering Aspose.

Following code snippet will help you.

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Style style = worksheet.Cells["A1"].GetStyle();
style.Number = 49;
worksheet.Cells["A1"].SetStyle(style);
worksheet.Cells["A1"].PutValue("86113371280692223");
workbook.Save("C:\\cellBGtest.xlsx", SaveFormat.Xlsx);

For more information:

See the following documents for your reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-display-formats-of-numbers-dates.html

You may see the following video tutorials too:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/set-display-formats-of-numbers-and-dates.html

You can also check the demo too:
http://www.aspose.com/demos/.net-components/aspose.cells/csharp/quick-start/formatting/number-formatting.aspx

Thanks,

Hi,

The code shared by Salman Shakeel will convert the numbers to text format. If you want to insert pure numeric values or numbers, see the sample code below for your requirements. It is to be noted here, Aspose.Cells for .NET works in the same way as MS Excel.

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Style style = worksheet.Cells[“A1”].GetStyle();
style.Custom = “00000000000000000”;
worksheet.Cells[“A1”].SetStyle(style);
worksheet.Cells[“A1”].PutValue(86113371280692223);
workbook.Save(“e:\test\cellBGtest.xlsx”, SaveFormat.Xlsx);


Thank you.