Free Support Forum - aspose.com

How can I change cell type?

I need to set cell type to int. How can I do this?

Just put an integer to that cell.

I may misunderstood your need. Do you want to put a decimal to a cell and just want to show an integer in that cell? You can use Cell.Style.Number or Cell.Style.Custom to set number format.

I wont to put a string to a cell and change type to number format in that cell

I have double myDouble=12345, if I put it to a cell it will value “1,23450+5E” value in the cell. Thsat why I put it in string format: cell.PutValue(String.Format("{0:G}",myDouble), and after that I wont ot change type to number. Or may be when I change format cell value will be “1,23450+5E” again?

You don’t need to put string to that cell and convert it back to integer. Please set number format to that cell.

cell.PutValue(12345);
cell.Style.Number = 0;