ASF Bugzilla – Attachment 21987 Details for
Bug 45060
Token Class Transformation incorrect when function expects 'reference' but arg is 'value'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
test case
Test.java (text/plain), 1.64 KB, created by
Andreas Goetz
on 2008-05-22 04:17:33 UTC
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Andreas Goetz
Created:
2008-05-22 04:17:33 UTC
Size:
1.64 KB
patch
obsolete
>import java.io.*; >import java.util.*; > >import org.apache.poi.hssf.usermodel.*; > >public class Test >{ > static int row = 0; > > static HSSFSheet sheet; > > static HSSFCellStyle xlsDateStyle, xlsNumericStyle, xlsPercentStyle; > > /** > * @param args > * @throws Exception > */ > public static void main(String[] args) throws Exception > { > FileOutputStream out = new FileOutputStream("d:\\test.xls"); > HSSFWorkbook wb = new HSSFWorkbook(); > > sheet = wb.createSheet("test"); > > // Excel-formatted date object > xlsDateStyle = wb.createCellStyle(); > xlsDateStyle.setDataFormat(wb.createDataFormat().getFormat("dd.mm.yyyy")); > > // Excel-formatted number > xlsNumericStyle = wb.createCellStyle(); > xlsNumericStyle.setDataFormat(wb.createDataFormat().getFormat("0.00")); > > // Excel-formatted percent object > xlsPercentStyle = wb.createCellStyle(); > xlsPercentStyle.setDataFormat(wb.createDataFormat().getFormat("0.00%")); > > addRow(new Date(0, 0, 1), 100.0); > addRow(new Date(1, 0, 1), -110.0); > > HSSFRow r = sheet.createRow(row++); > > // create the IRR formula > short col = 2; > HSSFCell c = r.createCell(col++); > c.setCellStyle(xlsPercentStyle); > c.setCellType(HSSFCell.CELL_TYPE_FORMULA); > c.setCellFormula("(1+IRR(SUMIF(A:A,ROW(INDIRECT(MIN(A:A)&\":\"&MAX(A:A))),B:B),0))^365-1"); > > wb.write(out); > out.close(); > } > > private static void addRow(Date date, double d) > { > HSSFRow r = sheet.createRow(row++); > > short col = 0; > HSSFCell c = r.createCell(col++); > c.setCellValue(date); > c.setCellStyle(xlsDateStyle); > > c = r.createCell(col++); > c.setCellValue(d); > c.setCellStyle(xlsNumericStyle); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 45060
: 21987