diff options
author | Yegor Kozlov <yegor@apache.org> | 2008-11-14 11:56:41 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2008-11-14 11:56:41 +0000 |
commit | c67c1d5ca0545d59ca3b8515bd78e7f02328c118 (patch) | |
tree | 3dcff450c33781788555bd27ae62dee84b902670 /src/ooxml/java/org | |
parent | dfa42cbf38a6e7adf0e98cc6e76f6126c9fc4617 (diff) | |
download | poi-c67c1d5ca0545d59ca3b8515bd78e7f02328c118.tar.gz poi-c67c1d5ca0545d59ca3b8515bd78e7f02328c118.zip |
1. fixed XSSFSheet.groupRow and ungroupRow to operate on 0-based arguments, was 1-based2. repackaged common xssh-hssf examples, created a page in the site for them 3. converted broken non-ascii characters to unicode in TestMetaDataIPI and TestWriteWellKnown
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org')
-rwxr-xr-x | src/ooxml/java/org/apache/poi/xssf/dev/XSSFSave.java | 2 | ||||
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 34 |
2 files changed, 24 insertions, 12 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/dev/XSSFSave.java b/src/ooxml/java/org/apache/poi/xssf/dev/XSSFSave.java index 148a02fcb2..10a4b4755e 100755 --- a/src/ooxml/java/org/apache/poi/xssf/dev/XSSFSave.java +++ b/src/ooxml/java/org/apache/poi/xssf/dev/XSSFSave.java @@ -32,7 +32,7 @@ public class XSSFSave { XSSFWorkbook wb = new XSSFWorkbook(args[i]);
int sep = args[i].lastIndexOf('.');
- String outfile = args[i].substring(0, sep) + "-save.xlsx";
+ String outfile = args[i].substring(0, sep) + "-save.xls" + (wb.isMacroEnabled() ? "m" : "x");
FileOutputStream out = new FileOutputStream(outfile);
wb.write(out);
out.close();
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 24a3f252f0..7613c87cf1 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -952,20 +952,26 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { setSheetFormatPrOutlineLevelCol(); } + /** + * Tie a range of cell together so that they can be collapsed or expanded + * + * @param fromRow start row (0-based) + * @param toRow end row (0-based) + */ public void groupRow(int fromRow, int toRow) { - for(int i=fromRow;i<=toRow;i++){ - XSSFRow xrow = getRow(i-1); - if(xrow == null){//create a new Row - xrow = createRow(i-1); + for (int i = fromRow; i <= toRow; i++) { + XSSFRow xrow = getRow(i); + if (xrow == null) { + xrow = createRow(i); } - CTRow ctrow=xrow.getCTRow(); - short outlineLevel=ctrow.getOutlineLevel(); - ctrow.setOutlineLevel((short)(outlineLevel+1)); - } - setSheetFormatPrOutlineLevelRow(); + CTRow ctrow = xrow.getCTRow(); + short outlineLevel = ctrow.getOutlineLevel(); + ctrow.setOutlineLevel((short) (outlineLevel + 1)); + } + setSheetFormatPrOutlineLevelRow(); } - private short getMaxOutlineLevelRows(){ + private short getMaxOutlineLevelRows(){ short outlineLevel=0; for(Row r : rows.values()){ XSSFRow xrow=(XSSFRow)r; @@ -1478,9 +1484,15 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { setSheetFormatPrOutlineLevelCol(); } + /** + * Ungroup a range of rows that were previously groupped + * + * @param fromRow start row (0-based) + * @param toRow end row (0-based) + */ public void ungroupRow(int fromRow, int toRow) { for (int i = fromRow; i <= toRow; i++) { - XSSFRow xrow = getRow(i - 1); + XSSFRow xrow = getRow(i); if (xrow != null) { CTRow ctrow = xrow.getCTRow(); short outlinelevel = ctrow.getOutlineLevel(); |