Reputation: 977
We have an issue where in the Format of the cells set as "Numeric Forrmat" in xls template is getting nullified (or) changed to General when the value is set from Java Code using JExcel API.
NumberFormat nf = new NumberFormat("#####.###");
WritableCellFormat format = new WritableCellFormat(nf);
ezCostSheet.setProtected(false);
format.setLocked(false);
format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLUE2);
cell.setCellFormat(format);
If anyone has tried this and solved, Please let us know the solution.
Upvotes: 1
Views: 574
Reputation: 12731
I experienced a similar, perhaps identical, issue where the Format that I defined in JExcel was behaving erratically.
After some digging, especially from here, I learned that the issue was with how I was using the format. I tried to share the formats I defined across multiple workbooks. The problem is that JExcel uses a reference index within the workbook to share the format when it is used multiple times. This mechanism is not supported across multiple workbooks. Here is a similar question capturing these details.
To use the jxl formats as they were intended to be used, you have to create a new format instance whenever you create a new workbook instance.
Upvotes: 1