JExcelApi currency format on formula cell - file error

I'm writing a spreadsheet with [JExcelApi][1]. I have two cells that I want to apply currency formatting to. From reading the API I discovered jxl.write.NumberFormat, which seems to do what I want. In my application I've written: NumberFormat currency = new NumberFormat(NumberFormat.CURRENCY_DOLLAR); WritableCellFormat currencyFormat = new WritableCellFormat(currency); cells.add(new Formula(col, row, myFormula, currencyFormat)); col and row are the column and row to write to. myFormula is the formula to be written. There's one AVERAGE() and one SUM(), each of which is written to a different cell. cells is an ArrayList which is writtten to the spreadsheet like this: for (WritableCell cell : cells) { ws.addCell(cell); } (There's a try/catch block around that, but it's irrelavent at the moment.) EDIT: ws is a WritableSheet obtained with WritableWorkbook.getSheet(String name). Everything else added to ws is written without a problem :) The file writes successfully, but when I open it I get the message "File error. Some number formats may have been lost." The cells I formatted above have not been formatted in the Excel file. I'm using Microsoft Excel 2003 SP3 and JExcelApi 2.6.10. Can anyone help me, please? Thanks in advance :) [1]: http://jexcelapi.sourceforge.net/

以上就是JExcelApi currency format on formula cell - file error的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏