Fix for bug 29747

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2004-06-27 11:08:02 +00:00
parent 2090d7dcab
commit 8a2f845479
4 changed files with 26 additions and 7 deletions

View File

@ -924,7 +924,8 @@ public class NameRecord extends Record {
.append("\n"); .append("\n");
buffer.append(" .Status bar text (Unicode string without length field) = ").append( field_17_status_bar_text ) buffer.append(" .Status bar text (Unicode string without length field) = ").append( field_17_status_bar_text )
.append("\n"); .append("\n");
buffer.append(org.apache.poi.util.HexDump.dump(this.field_13_raw_name_definition,0,0)); if (field_13_raw_name_definition != null)
buffer.append(org.apache.poi.util.HexDump.dump(this.field_13_raw_name_definition,0,0));
buffer.append("[/NAME]\n"); buffer.append("[/NAME]\n");
return buffer.toString(); return buffer.toString();

View File

@ -515,7 +515,7 @@ public class HSSFWorkbook
} }
if ( nameRecord == null ) if ( nameRecord == null )
{ {
nameRecord = workbook.createBuiltInName(NameRecord.BUILTIN_PRINT_TITLE, externSheetIndex+1); nameRecord = workbook.createBuiltInName(NameRecord.BUILTIN_PRINT_TITLE, sheetIndex+1);
//does a lot of the house keeping for builtin records, like setting lengths to zero etc //does a lot of the house keeping for builtin records, like setting lengths to zero etc
isNewRecord = true; isNewRecord = true;
} }

View File

@ -18,11 +18,7 @@
package org.apache.poi.hssf.usermodel; package org.apache.poi.hssf.usermodel;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -458,6 +454,7 @@ extends TestCase {
assertEquals("Re-Written Formula String Cell value", d1.getStringCellValue(), rd2.getStringCellValue()); assertEquals("Re-Written Formula String Cell value", d1.getStringCellValue(), rd2.getStringCellValue());
} }
} }

View File

@ -0,0 +1,21 @@
package org.apache.poi.hssf.usermodel;
import junit.framework.*;
import org.apache.poi.hssf.record.NameRecord;
public class TestHSSFWorkbook extends TestCase
{
HSSFWorkbook hssfWorkbook;
public void testSetRepeatingRowsAndColumns() throws Exception
{
// Test bug 29747
HSSFWorkbook b = new HSSFWorkbook( );
b.createSheet();
b.createSheet();
b.createSheet();
b.setRepeatingRowsAndColumns( 2, 0,1,-1,-1 );
NameRecord nameRecord = b.getWorkbook().getNameRecord( 0 );
assertEquals( 3, nameRecord.getIndexToSheet() );
}
}