poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52462] Add support for SUMIFS function
Date Mon, 23 Jan 2012 08:15:52 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52462

--- Comment #10 from Oleg Kuryan <oleg.kuryan@gmail.com> 2012-01-23 08:15:52 UTC ---
I'm Using for verification Excel 2010 in Russian language. Below is code that
create excel file with SUM and SUMIFS functions. Just to compare results.

As result I get attached excel file test.xls. Below are screenshots on how
formulas looks like in Russian version:
1) http://clip2net.com/s/1vOP4 - note that SUMIFS is not displayed in excel in
russian variant ("СУММАЕСЛИМН")
2) http://clip2net.com/s/1vOQ5 - note that here SUM function is properly
converted to russian variant "СУММ"

Code used for testing
---------------------
    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet();
    Row row = sheet.createRow((short) 0);
    Cell cell = row.createCell((short) 0);
    cell.setCellValue((String) "Number");
    cell = row.createCell((short) 1);
    cell.setCellValue((String) "Sum");
    cell = row.createCell((short) 2);
    cell.setCellValue((String) "Status");
    cell = row.createCell((short) 3);
    cell.setCellValue((String) "isDeleted");
    short maxSize = 10;
    for(short counter = 1; counter <= maxSize; counter++) {
      row = sheet.createRow(counter);
      cell = row.createCell((short) 0);
      cell.setCellValue(counter);
      cell = row.createCell((short) 1);
      cell.setCellValue(10000);
      cell = row.createCell((short) 2);
      cell.setCellValue("Opened");
      cell = row.createCell((short) 3);
      cell.setCellValue("Yes");

      if(counter == 1) {
        cell = row.createCell((short) 5);
        cell.setCellValue((String) "Total Not Working");
        cell = row.createCell((short) 6);
        String cellFormula = "SUMIFS(B2:B" + (maxSize + 1) + ", D2:D" +
(maxSize + 1) + ", \"=Yes\", C2:C" + (maxSize + 1) + ", \"=Opened\")";
        cell.setCellFormula(cellFormula);
      }  else if(counter == 2) {
        cell = row.createCell((short) 5);
        cell.setCellValue((String) "Total Working");
        cell = row.createCell((short) 6);
        String cellFormula =  "SUM(B2:B" + (maxSize + 1) + ")";
        cell.setCellFormula(cellFormula);
      }



    }

    try {
      FileOutputStream out = new FileOutputStream(new File("D:/test.xls"));
      wb.write(out);
      out.flush();
      out.close();
    } catch(IOException e) {
      e.printStackTrace();
    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message