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 2004/06/23 05:07:13 UTC

DO NOT REPLY [Bug 29747] New: - Bug in HSSFWorkbook:setRepeatingRowsAndColumns

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=29747>.
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=29747

Bug in HSSFWorkbook:setRepeatingRowsAndColumns

           Summary: Bug in HSSFWorkbook:setRepeatingRowsAndColumns
           Product: POI
           Version: 2.0FINAL
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: michael_zjm@hotmail.com


When we create a workbook from existing Excel file and create a new sheet from 
the work book, the "setRepeatingRowsAndColumns" method does not work. I have 
write a Junit test case to test it, and it is repeatable.

The Junit test is bellow:



package org.apache.poi.hssf.usermodel;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;

import junit.framework.TestCase;

import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.BackupRecord;
import org.apache.poi.hssf.record.LabelSSTRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;


public class TestWorkbook
    extends TestCase
{

    /**
     * Constructor TestWorkbook
     *
     * @param name
     */

    public TestWorkbook(String name)
    {
        super(name);
    }

    
    /**
     * Generate a file to visually/programmatically verify repeating rows and 
cols made it
     */
    public void testRepeatingColsRows() throws IOException
    {
      FileInputStream fis = new FileInputStream(new File
("c://temp//myExistFile.xls"));		
      HSSFWorkbook workbook = new HSSFWorkbook(fis);        
		HSSFSheet sheet = workbook.createSheet("Test Print 
Titles");                
		String sheetName = workbook.getSheetName(0);
	     
	    HSSFRow row = sheet.createRow(0);
	    
	    HSSFCell cell = row.createCell((short)1);
	    cell.setCellValue("hi");
	     
	     
		workbook.setRepeatingRowsAndColumns(workbook.getSheetIndex
("Test Print Titles"), 0, 1, 0, 0); 
	     
		File file;// = File.createTempFile
("testPrintTitles",".xls");        
                
                file = new File("c://temp//mytest.xls");
	     
		FileOutputStream fileOut = new FileOutputStream(file);
		workbook.write(fileOut);
		fileOut.close();
	     
		assertTrue("file exists",file.exists());
	     
    	
    }
  
    
    public static void main(String [] ignored_args)
    {
        String filename = System.getProperty("HSSF.testdata.path");

        // assume this is relative to basedir
        if (filename == null)
        {
            System.setProperty(
                "HSSF.testdata.path",
                "src/testcases/org/apache/poi/hssf/data");
        }
        System.out
            .println("Testing org.apache.poi.hssf.usermodel.HSSFWorkbook");
        junit.textui.TestRunner.run(TestWorkbook.class);
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org