Free Support Forum - aspose.com

Pls help me to Format cell in Aspose.Cell

Iam entering data in cell as 916756756767 but it is coming as 91E778

something .pls give me the suggestion as earlier as possible

I tried like this

Worksheet sheet = workbook.getWorksheets().getSheet(sheetNum);Style style = workbook.createStyle();

style.setHAlignment(TextAlignmentType.LEFT);

style.setNumber(1);

Cell cell = sheet.getCells().getCell(rowIndex, columnIndex);

if (cellData != null) {

cell.setValue(cellData);

}

cell.setStyle(style);

but it is not working


This message was posted using Aspose.Live 2 Forum

Hi,

Well, I don't find any problem, following is my testing code and attached is the output excel file.

Sample code:

try {
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().getSheet(0);
Cell cell = sheet.getCells().getCell(0, 0);
cell.setValue("916756756767",true);
Style style = workbook.createStyle();
style.setHAlignment(TextAlignmentType.LEFT);
style.setNumber(1);
cell.setStyle(style);
sheet.autoFitColumn(0);
workbook.save("e:\\Files\\new_formatbook.xls",FileFormatType.EXCEL2003);


} catch (IOException e) {
e.printStackTrace();
}

Which version of Aspose.Cells for Java you are using, could you try the 1.9.4.9 attached at the thread: http://www.aspose.com/community/forums/thread/121704.aspx

Thank you.