From fbae3f94221d6ba12634dd85e23eca5f63f8ec02 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Fri, 6 Nov 2009 19:40:07 +0000 Subject: [PATCH] added a method to set arabic mode in HSSFSheet, see Bugzilla 47970 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@833537 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/hssf/usermodel/HSSFSheet.java | 17 +++++++++++++++++ .../poi/hssf/usermodel/TestHSSFSheet.java | 13 +++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index a5e5baafff..7725c909d2 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 47970 - added a method to set arabic mode in HSSFSheet 48134 - release system resources when using Picture.resize() 48087 - avoid NPE in XSSFChartSheet when calling methods of the superclass 48038 - handle reading HWPF stylesheets from non zero offsets diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index d526d6de9d..d626a82341 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -634,7 +634,24 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { return _sheet.getPageSettings().getHCenter().getHCenter(); } + /** + * Sets the arabic property for this sheet, will make it right to left. + * @param value true for arabic, false otherwise. + */ + public void setArabic(boolean value) + { + _sheet.getWindowTwo().setArabic(value); + } + /** + * Gets the arabic property for this sheet. + * + * @return whther the arabic mode is set + */ + public boolean isArabic() + { + return _sheet.getWindowTwo().getArabic(); + } /** * removes a merged region of cells (hence letting them free) diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index ee8e0e8245..bdb15563b8 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -802,4 +802,17 @@ public final class TestHSSFSheet extends BaseTestSheet { assertFalse(cs.getFont(wbComplex).getItalic()); assertEquals(HSSFFont.BOLDWEIGHT_BOLD, cs.getFont(wbComplex).getBoldweight()); } + + /** + * Tests the arabic setting + */ + public void testArabic() { + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet s = wb.createSheet(); + + assertEquals(false, s.isArabic()); + s.setArabic(true); + assertEquals(true, s.isArabic()); + } + } -- 2.39.5