mirror of https://github.com/apache/poi.git
Make setLandscape(false) and setLeftToRight(false) do what one would expect
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1686019 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70b17d739f
commit
39955f60f8
|
@ -120,6 +120,8 @@ public class XSSFPrintSetup implements PrintSetup {
|
|||
public void setLeftToRight(boolean ltor) {
|
||||
if (ltor)
|
||||
setPageOrder(PageOrder.OVER_THEN_DOWN);
|
||||
else
|
||||
setPageOrder(PageOrder.DOWN_THEN_OVER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,6 +132,8 @@ public class XSSFPrintSetup implements PrintSetup {
|
|||
public void setLandscape(boolean ls) {
|
||||
if (ls)
|
||||
setOrientation(PrintOrientation.LANDSCAPE);
|
||||
else
|
||||
setOrientation(PrintOrientation.PORTRAIT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,12 +19,18 @@ package org.apache.poi.xssf.usermodel;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
||||
import org.apache.poi.ss.usermodel.PaperSize;
|
||||
import org.apache.poi.ss.usermodel.PageOrder;
|
||||
import org.apache.poi.ss.usermodel.PrintOrientation;
|
||||
import org.apache.poi.ss.usermodel.PaperSize;
|
||||
import org.apache.poi.ss.usermodel.PrintCellComments;
|
||||
import org.apache.poi.ss.usermodel.PrintOrientation;
|
||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||
import org.junit.Test;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageMargins;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageSetup;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellComments;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STOrientation;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPageOrder;
|
||||
|
||||
/**
|
||||
* Tests for {@link XSSFPrintSetup}
|
||||
|
@ -226,10 +232,10 @@ public class TestXSSFPrintSetup extends TestCase {
|
|||
assertEquals(true, s2.getCTWorksheet().isSetPageMargins());
|
||||
|
||||
// Round trip and check
|
||||
wb = XSSFITestDataProvider.instance.writeOutAndReadBack(wb);
|
||||
XSSFWorkbook wbBack = XSSFITestDataProvider.instance.writeOutAndReadBack(wb);
|
||||
|
||||
s1 = wb.getSheetAt(0);
|
||||
s2 = wb.getSheetAt(1);
|
||||
s1 = wbBack.getSheetAt(0);
|
||||
s2 = wbBack.getSheetAt(1);
|
||||
|
||||
assertEquals(true, s1.getCTWorksheet().isSetPageSetup());
|
||||
assertEquals(true, s1.getCTWorksheet().isSetPageMargins());
|
||||
|
@ -239,6 +245,8 @@ public class TestXSSFPrintSetup extends TestCase {
|
|||
print = s1.getPrintSetup();
|
||||
assertEquals(3, print.getCopies());
|
||||
assertEquals(true, print.getLandscape());
|
||||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -248,4 +256,30 @@ public class TestXSSFPrintSetup extends TestCase {
|
|||
public void testRoundTrip() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetLandscapeFalse() throws Exception {
|
||||
XSSFPrintSetup ps = new XSSFPrintSetup(CTWorksheet.Factory.newInstance());
|
||||
|
||||
assertFalse(ps.getLandscape());
|
||||
|
||||
ps.setLandscape(true);
|
||||
assertTrue(ps.getLandscape());
|
||||
|
||||
ps.setLandscape(false);
|
||||
assertFalse(ps.getLandscape());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetLeftToRight() throws Exception {
|
||||
XSSFPrintSetup ps = new XSSFPrintSetup(CTWorksheet.Factory.newInstance());
|
||||
|
||||
assertFalse(ps.getLeftToRight());
|
||||
|
||||
ps.setLeftToRight(true);
|
||||
assertTrue(ps.getLeftToRight());
|
||||
|
||||
ps.setLeftToRight(false);
|
||||
assertFalse(ps.getLeftToRight());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue