Now I got the latest src from trunk and built it with
ant: poi-3.9-beta1-20121024.jar
I replaced the old jar in my project with the new one, everything fine (I
thought), HSSFSheet had some new methods setRepeatingRows and
setRepeatingColumns.
Now I use this code and get the same error when opening it with MS Excel
2003?? In German it says: "Namenskonflikt. Name darf integriertem Namen
nicht gleichen. Alter Name: Drucktitel, Neuer Name: _______
What's wrong? I looked the sources and I think there is something with the
HSSFName in line 2175/2176 in HSSFSheet.java
(java/org/apache/poi/hssf/usermodel)
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("first");
HSSFSheet sheet2 = wb.createSheet("second");
HSSFSheet sheet3 = wb.createSheet("third");
HSSFSheet sheet4 = wb.createSheet("fourth");
HSSFRow row11 = sheet1.createRow(0);
HSSFRow row12 = sheet1.createRow(1);
HSSFRow row13 = sheet1.createRow(2);
HSSFRow row21 = sheet2.createRow(0);
HSSFRow row22 = sheet2.createRow(1);
HSSFRow row23 = sheet2.createRow(2);
HSSFRow row31 = sheet3.createRow(0);
HSSFRow row32 = sheet3.createRow(1);
HSSFRow row33 = sheet3.createRow(2);
HSSFRow row41 = sheet4.createRow(0);
HSSFRow row42 = sheet4.createRow(1);
HSSFRow row43 = sheet4.createRow(2);
row11.createCell(0).setCellValue("first1");
row11.createCell(1).setCellValue("first2");
row11.createCell(2).setCellValue("first3");
row12.createCell(0).setCellValue("body");
row12.createCell(1).setCellValue("body");
row12.createCell(2).setCellValue("body");
row13.createCell(0).setCellValue("body");
row13.createCell(1).setCellValue("body");
row13.createCell(2).setCellValue("body");
row21.createCell(0).setCellValue("head1");
row21.createCell(1).setCellValue("head2");
row21.createCell(2).setCellValue("head3");
row22.createCell(0).setCellValue("body_sec");
row22.createCell(1).setCellValue("body_sec");
row22.createCell(2).setCellValue("body_sec");
row23.createCell(0).setCellValue("body_sec");
row23.createCell(1).setCellValue("body_sec");
row23.createCell(2).setCellValue("body_sec");
row31.createCell(0).setCellValue("head1");
row31.createCell(1).setCellValue("head2");
row31.createCell(2).setCellValue("head3");
row32.createCell(0).setCellValue("body_thrd");
row32.createCell(1).setCellValue("body_thrd");
row32.createCell(2).setCellValue("body_thrd");
row33.createCell(0).setCellValue("body_thrd");
row33.createCell(1).setCellValue("body_thrd");
row33.createCell(2).setCellValue("body_thrd");
row31.createCell(0).setCellValue("head1");
row31.createCell(1).setCellValue("head2");
row31.createCell(2).setCellValue("head3");
row32.createCell(0).setCellValue("body_frth");
row32.createCell(1).setCellValue("body_frth");
row32.createCell(2).setCellValue("body_frth");
row33.createCell(0).setCellValue("body_frth");
row33.createCell(1).setCellValue("body_frth");
row33.createCell(2).setCellValue("body_frth");
/* old methods
wb.setRepeatingRowsAndColumns(0, -1, -1, 0, 0);
wb.setRepeatingRowsAndColumns(1, -1, -1, 0, 0);
wb.setRepeatingRowsAndColumns(2, -1, -1, 0, 0);
wb.setRepeatingRowsAndColumns(3, -1, -1, 0, 0); //this is the bad
line
//if I remove this
line, everything works fine
//if it's there, I
get a name conflict
*/ now the new ones
CellRangeAddress reap = new CellRangeAddress(0, 1, -1, -1);
sheet1.setRepeatingRows(reap);
sheet2.setRepeatingRows(reap);
sheet3.setRepeatingRows(reap);
sheet4.setRepeatingRows(reap);
FileOutputStream fileOut = new
FileOutputStream("/home/muench/Arbeitsfläche/transfers/Test_RepeatingRowsAndColumns.xls");
wb.write(fileOut);
fileOut.close();
2012/10/19 Hans Maulwurf <[email protected]>
> is this the latest build from trunk or where can i get it?
>
>
> 2012/10/17 Hans Maulwurf <[email protected]>
>
>> i use poi-3.8-20120326.jar
>>
>>
>> 2012/10/17 Yegor Kozlov <[email protected]>
>>
>>> which version of POI are you using? Your code runs without errors with
>>> the latest build from trunk.
>>>
>>>
>>>
>>> On Wed, Oct 17, 2012 at 3:28 PM, Hans Maulwurf
>>> <[email protected]> wrote:
>>> > Sure, maybe it's too simple to solve it by myself :P
>>> >
>>> > here is the test-code:
>>> >
>>> > HSSFWorkbook wb = new HSSFWorkbook();
>>> >
>>> > HSSFSheet sheet1 = wb.createSheet("first");
>>> > HSSFSheet sheet2 = wb.createSheet("second");
>>> > HSSFSheet sheet3 = wb.createSheet("third");
>>> > HSSFSheet sheet4 = wb.createSheet("fourth");
>>> >
>>> > HSSFRow row11 = sheet1.createRow(0);
>>> > HSSFRow row12 = sheet1.createRow(1);
>>> > HSSFRow row13 = sheet1.createRow(2);
>>> >
>>> > HSSFRow row21 = sheet2.createRow(0);
>>> > HSSFRow row22 = sheet2.createRow(1);
>>> > HSSFRow row23 = sheet2.createRow(2);
>>> >
>>> > HSSFRow row31 = sheet3.createRow(0);
>>> > HSSFRow row32 = sheet3.createRow(1);
>>> > HSSFRow row33 = sheet3.createRow(2);
>>> >
>>> > HSSFRow row41 = sheet4.createRow(0);
>>> > HSSFRow row42 = sheet4.createRow(1);
>>> > HSSFRow row43 = sheet4.createRow(2);
>>> >
>>> > row11.createCell(0).setCellValue("first1");
>>> > row11.createCell(1).setCellValue("first2");
>>> > row11.createCell(2).setCellValue("first3");
>>> > row12.createCell(0).setCellValue("body");
>>> > row12.createCell(1).setCellValue("body");
>>> > row12.createCell(2).setCellValue("body");
>>> > row13.createCell(0).setCellValue("body");
>>> > row13.createCell(1).setCellValue("body");
>>> > row13.createCell(2).setCellValue("body");
>>> >
>>> > row21.createCell(0).setCellValue("head1");
>>> > row21.createCell(1).setCellValue("head2");
>>> > row21.createCell(2).setCellValue("head3");
>>> > row22.createCell(0).setCellValue("body_sec");
>>> > row22.createCell(1).setCellValue("body_sec");
>>> > row22.createCell(2).setCellValue("body_sec");
>>> > row23.createCell(0).setCellValue("body_sec");
>>> > row23.createCell(1).setCellValue("body_sec");
>>> > row23.createCell(2).setCellValue("body_sec");
>>> >
>>> > row31.createCell(0).setCellValue("head1");
>>> > row31.createCell(1).setCellValue("head2");
>>> > row31.createCell(2).setCellValue("head3");
>>> > row32.createCell(0).setCellValue("body_thrd");
>>> > row32.createCell(1).setCellValue("body_thrd");
>>> > row32.createCell(2).setCellValue("body_thrd");
>>> > row33.createCell(0).setCellValue("body_thrd");
>>> > row33.createCell(1).setCellValue("body_thrd");
>>> > row33.createCell(2).setCellValue("body_thrd");
>>> >
>>> > row31.createCell(0).setCellValue("head1");
>>> > row31.createCell(1).setCellValue("head2");
>>> > row31.createCell(2).setCellValue("head3");
>>> > row32.createCell(0).setCellValue("body_frth");
>>> > row32.createCell(1).setCellValue("body_frth");
>>> > row32.createCell(2).setCellValue("body_frth");
>>> > row33.createCell(0).setCellValue("body_frth");
>>> > row33.createCell(1).setCellValue("body_frth");
>>> > row33.createCell(2).setCellValue("body_frth");
>>> >
>>> >
>>> > wb.setRepeatingRowsAndColumns(0, -1, -1, 0, 0);
>>> >
>>> > wb.setRepeatingRowsAndColumns(1, -1, -1, 0, 0);
>>> >
>>> > wb.setRepeatingRowsAndColumns(2, -1, -1, 0, 0);
>>> >
>>> > wb.setRepeatingRowsAndColumns(3, -1, -1, 0, 0); //this is the
>>> bad
>>> > line
>>> > //if I remove
>>> this
>>> > line, everything works fine
>>> > //if it's
>>> there, I
>>> > get a name conflict
>>> >
>>> > FileOutputStream fileOut = new
>>> >
>>> FileOutputStream("/home/muench/Arbeitsfläche/transfers/Test_RepeatingRowsAndColumns.xls");
>>> > wb.write(fileOut);
>>> > fileOut.close();
>>> >
>>> >
>>> > Maybe you can workaround. Thanks for your help :)
>>> >
>>> >
>>> >
>>> > 2012/10/17 Yegor Kozlov <[email protected]>
>>> >
>>> >> can you narrow it down to a simple failing test case ?
>>> >>
>>> >> On Tue, Oct 16, 2012 at 5:42 PM, Hans Maulwurf
>>> >> <[email protected]> wrote:
>>> >> > creating everything from scratch
>>> >> >
>>> >> >
>>> >> > 2012/10/16 Yegor Kozlov <[email protected]>
>>> >> >
>>> >> >> are creating a new workbook from scratch or modifying a template ?
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> On Tue, Oct 16, 2012 at 5:22 PM, Hans Maulwurf
>>> >> >> <[email protected]> wrote:
>>> >> >> > Hello,
>>> >> >> >
>>> >> >> > I want to set setRepeatingRowsAndColumns for each sheet the
>>> same. I
>>> >> >> always
>>> >> >> > use setRepeatingRowsAndColumns(i, -1, -1, 0, 0) (counting i in a
>>> loop)
>>> >> >> but
>>> >> >> > when opening the xls, a name conflict (DruckTitel) is shown??
>>> where
>>> >> can I
>>> >> >> > set the name of the DruckTitel (i guess it's print area?) It's
>>> >> confusing
>>> >> >> > because this method doesn't ask for a name :(
>>> >> >> >
>>> >> >> > thanks for your help & greetings,
>>> >> >> >
>>> >> >> > Hans
>>> >> >>
>>> >> >>
>>> ---------------------------------------------------------------------
>>> >> >> To unsubscribe, e-mail: [email protected]
>>> >> >> For additional commands, e-mail: [email protected]
>>> >> >>
>>> >> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: [email protected]
>>> >> For additional commands, e-mail: [email protected]
>>> >>
>>> >>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>