You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by knaka <na...@xb4.so-net.ne.jp> on 2014/01/23 06:24:18 UTC

Unable to set Landscape if RepeatingRows is set for the sheet

Hi,

I am trying to set the orientation for printing the .xlsx file to
"Landscape". But the orientation becomes "Portrait". The test program I made
is like the following.

SXSSFWorkbook wb = new SXSSFWorkbook(100);
Sheet sh = wb.createSheet();
sh.setRepeatingRows(CellRangeAddress.valueOf("1:1"));
XSSFPrintSetup ps = (XSSFPrintSetup) sh.getPrintSetup();
*ps.setLandscape(true);*		
try {
  FileOutputStream out = new FileOutputStream("Test.xlsx");
  wb.write(out);
  out.close();
  wb.dispose();
} catch (Exception e) {
  System.out.print("Exception happens!!!");
}

However when I commented out the line of
"sh.setRepeatingRows(CellRangeAddress.valueOf("1:1"));", the orientation was
set to "Landscape".
I would like to make use of "RepeatingRows" feature. Please tell me how to
set the orientation to "Landscape" in conjunction with the "RepeatingRows"
feature.

Incidentally I use Apache POI 3.9.

Regards,



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-set-Landscape-if-RepeatingRows-is-set-for-the-sheet-tp5714727.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: Unable to set Landscape if RepeatingRows is set for the sheet

Posted by Dominik Stadler <do...@gmx.at>.
Hmm,

we have a unit test which tries to verify that this does not happen at
TestXSSFBugs.bug49253(), maybe you can try to find out what the
difference in your case is?

Thanks... Dominik.

On Tue, Jun 16, 2015 at 5:03 PM, normandenton <no...@redmane.com> wrote:
> Hi Ryo.
>
> Thanks very much for your post!!! I have wasted a lot of time trying to find
> out why setLandscape(true) was having no effect and I see that many other
> poor people have also being struggling with it. It would be so nice if the
> Javadoc for this method or something else in the POI documentation would
> warn people that setRepeatingRows() called before setLandscape(true) will
> inhibit this method.
>
> Regards,
> Norman Denton.
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-set-Landscape-if-RepeatingRows-is-set-for-the-sheet-tp5714727p5719117.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

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


RE: Unable to set Landscape if RepeatingRows is set for the sheet

Posted by normandenton <no...@redmane.com>.
Hi Ryo.

Thanks very much for your post!!! I have wasted a lot of time trying to find
out why setLandscape(true) was having no effect and I see that many other
poor people have also being struggling with it. It would be so nice if the
Javadoc for this method or something else in the POI documentation would
warn people that setRepeatingRows() called before setLandscape(true) will
inhibit this method.

Regards,
Norman Denton.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-set-Landscape-if-RepeatingRows-is-set-for-the-sheet-tp5714727p5719117.html
Sent from the POI - User mailing list archive at Nabble.com.

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


RE: Unable to set Landscape if RepeatingRows is set for the sheet

Posted by knaka <na...@xb4.so-net.ne.jp>.
Thank you Ryo!

I was able to set the orientation to "Landscape" by changing the order of
the setRepeatingRows as you mentioned.
Incidentally the tag of pageSetup becomes the same as the case where
RepearingRows is unset like the following.
*<pageSetup orientation="landscape"/>*

Many Thanks,



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-set-Landscape-if-RepeatingRows-is-set-for-the-sheet-tp5714727p5714733.html
Sent from the POI - User mailing list archive at Nabble.com.

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


RE: Unable to set Landscape if RepeatingRows is set for the sheet

Posted by 山本 亮 <ry...@yjk.co.jp>.
I don't know why, but it works fine when setRepeatiingRows method called after setLandscape.

  SXSSFWorkbook wb = new SXSSFWorkbook(100);
  Sheet sh = wb.createSheet();
  XSSFPrintSetup ps = (XSSFPrintSetup) sh.getPrintSetup();
  ps.setLandscape(true);                
  sh.setRepeatingRows(CellRangeAddress.valueOf("1:1"));
  try {
    FileOutputStream out = new FileOutputStream("Test.xlsx");
    wb.write(out);
    out.close();
    wb.dispose();
  } catch (Exception e) {
    System.out.print("Exception happens!!!");
  }        

Ryo Yamamoto

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