You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2006/07/25 13:45:30 UTC

DO NOT REPLY [Bug 29713] - setRepeatingRowsAndColumns not working

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29713>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29713





------- Additional Comments From f.ressel@web.de  2006-07-25 11:45 -------
Depending on the sheet name, works setRepeatingRowsAndColumns correct or even 
not. But, I can not find why .....

My TestCase

public class TestRepeatingRowsAndColumns extends TestCase
{
   public void testRepeatingColsRows() throws IOException
   {
      HSSFWorkbook wb = new HSSFWorkbook();

      String[] sheets =

      // Works
      //  {"1234567890123456789012345678901",
      //   "1234567890123456789012345678902",
      //   "1234567890123456789012345678903",
      //   "1234567890123456789012345678904",
      //   "1234567890123456789012345678905"};
         
      // Not Works
      //  {"123456789012345678901234567890�",
      //   "1234567890123456789012345678902",
      //   "1234567890123456789012345678903",
      //   "1234567890123456789012345678904",
      //   "1234567890123456789012345678905"};

      // But .. Works
      //  {"Bl��� 1",
      //   "Bl��� 2",
      //   "Bl��� 3",
      //   "Bl��� 4",
      //   "Bl��� 5"};

      for (int i = 0; i < sheets.length; i++)
      {
         HSSFSheet s = wb.createSheet(sheets[i]);
         int row = 0;
         getCell(s, row++, 0).setCellValue(
                  new HSSFRichTextString("Print header"));

         for (int j = 1; j < 200; j++)
         {
            getCell(s, row, 0).setCellValue(
                     new HSSFRichTextString("Data line: " + j));
            getCell(s, row, 2).setCellValue(j);
            row++;
         }
         getCell(s, row, 2).setCellFormula("sum(C2:C200)");
      }

      for (int i = 0; i < wb.getNumberOfSheets(); i++)
      {
         wb.setRepeatingRowsAndColumns(i, -1, -1, 0, 0);
      }

      FileOutputStream fos = new FileOutputStream(new File(
               "c://temp//newTestRepeatingColsRows.xls"));
      wb.write(fos);
   }

   private HSSFCell getCell(HSSFSheet s, int rowNum, int columnNum)
   {
      HSSFRow r = s.getRow(rowNum);
      if (r == null)
      {
         r = s.createRow(rowNum);
      }
      HSSFCell cell = r.getCell((short) columnNum);
      if (cell == null)
      {
         cell = r.createCell((short) columnNum);
      }
      return cell;
   }
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/