Bugzilla 51673 - support grouping rows in SXSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1295058 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c0e87067e6
commit
c2d898c25a
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.8-beta6" date="2012-??-??">
|
<release version="3.8-beta6" date="2012-??-??">
|
||||||
|
<action dev="poi-developers" type="add">51673 - support grouping rows in SXSSF</action>
|
||||||
<action dev="poi-developers" type="add">51780 - support replacement of content types in OPC packages </action>
|
<action dev="poi-developers" type="add">51780 - support replacement of content types in OPC packages </action>
|
||||||
<action dev="poi-developers" type="fix">52784 - replace ISO control characters with question marks in SXSSF to be consistent with XSSF </action>
|
<action dev="poi-developers" type="fix">52784 - replace ISO control characters with question marks in SXSSF to be consistent with XSSF </action>
|
||||||
<action dev="poi-developers" type="add">52057 - updated formula test framework to be aware of recently added Functions </action>
|
<action dev="poi-developers" type="add">52057 - updated formula test framework to be aware of recently added Functions </action>
|
||||||
|
@ -25,7 +25,6 @@ import org.apache.poi.ss.usermodel.Cell;
|
|||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streaming version of XSSFRow implementing the "BigGridDemo" strategy.
|
* Streaming version of XSSFRow implementing the "BigGridDemo" strategy.
|
||||||
@ -40,6 +39,7 @@ public class SXSSFRow implements Row
|
|||||||
short _style=-1;
|
short _style=-1;
|
||||||
short _height=-1;
|
short _height=-1;
|
||||||
boolean _zHeight = false;
|
boolean _zHeight = false;
|
||||||
|
int _outlineLevel = 0; // Outlining level of the row, when outlining is on
|
||||||
|
|
||||||
public SXSSFRow(SXSSFSheet sheet, int initialSize)
|
public SXSSFRow(SXSSFSheet sheet, int initialSize)
|
||||||
{
|
{
|
||||||
@ -54,6 +54,14 @@ public class SXSSFRow implements Row
|
|||||||
{
|
{
|
||||||
return _height!=-1;
|
return _height!=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getOutlineLevel(){
|
||||||
|
return _outlineLevel;
|
||||||
|
}
|
||||||
|
void setOutlineLevel(int level){
|
||||||
|
_outlineLevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
//begin of interface implementation
|
//begin of interface implementation
|
||||||
public Iterator<Cell> iterator()
|
public Iterator<Cell> iterator()
|
||||||
{
|
{
|
||||||
|
@ -26,11 +26,12 @@ import org.apache.poi.ss.SpreadsheetVersion;
|
|||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
|
||||||
import org.apache.poi.ss.util.SheetUtil;
|
import org.apache.poi.ss.util.SheetUtil;
|
||||||
import org.apache.poi.util.Internal;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
|
||||||
import org.apache.poi.hssf.util.PaneInformation;
|
import org.apache.poi.hssf.util.PaneInformation;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streaming version of XSSFSheet implementing the "BigGridDemo" strategy.
|
* Streaming version of XSSFSheet implementing the "BigGridDemo" strategy.
|
||||||
@ -44,6 +45,7 @@ public class SXSSFSheet implements Sheet, Cloneable
|
|||||||
TreeMap<Integer,SXSSFRow> _rows=new TreeMap<Integer,SXSSFRow>();
|
TreeMap<Integer,SXSSFRow> _rows=new TreeMap<Integer,SXSSFRow>();
|
||||||
SheetDataWriter _writer;
|
SheetDataWriter _writer;
|
||||||
int _randomAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE;
|
int _randomAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE;
|
||||||
|
int outlineLevelRow = 0;
|
||||||
|
|
||||||
public SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet xSheet) throws IOException
|
public SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet xSheet) throws IOException
|
||||||
{
|
{
|
||||||
@ -1036,7 +1038,18 @@ public class SXSSFSheet implements Sheet, Cloneable
|
|||||||
*/
|
*/
|
||||||
public void groupRow(int fromRow, int toRow)
|
public void groupRow(int fromRow, int toRow)
|
||||||
{
|
{
|
||||||
_sh.groupRow(fromRow, toRow);
|
for(SXSSFRow row : _rows.subMap(fromRow, toRow + 1).values()){
|
||||||
|
int level = row.getOutlineLevel() + 1;
|
||||||
|
row.setOutlineLevel(level);
|
||||||
|
|
||||||
|
if(level > outlineLevelRow) outlineLevelRow = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTWorksheet ct = _sh.getCTWorksheet();
|
||||||
|
CTSheetFormatPr pr = ct.isSetSheetFormatPr() ?
|
||||||
|
ct.getSheetFormatPr() :
|
||||||
|
ct.addNewSheetFormatPr();
|
||||||
|
pr.setOutlineLevelRow((short)outlineLevelRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1058,7 +1071,8 @@ public class SXSSFSheet implements Sheet, Cloneable
|
|||||||
*/
|
*/
|
||||||
public void setRowGroupCollapsed(int row, boolean collapse)
|
public void setRowGroupCollapsed(int row, boolean collapse)
|
||||||
{
|
{
|
||||||
_sh.setRowGroupCollapsed(row, collapse);
|
//_sh.setRowGroupCollapsed(row, collapse);
|
||||||
|
throw new RuntimeException("Not Implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,6 +137,9 @@ public class SheetDataWriter {
|
|||||||
_out.write(" s=\"" + row._style + "\"");
|
_out.write(" s=\"" + row._style + "\"");
|
||||||
_out.write(" customFormat=\"1\"");
|
_out.write(" customFormat=\"1\"");
|
||||||
}
|
}
|
||||||
|
if (row.getOutlineLevel() != 0) {
|
||||||
|
_out.write(" outlineLevel=\"" + row.getOutlineLevel() + "\"");
|
||||||
|
}
|
||||||
_out.write(">\n");
|
_out.write(">\n");
|
||||||
this._rownum = rownum;
|
this._rownum = rownum;
|
||||||
_rowContainedNullCells = false;
|
_rowContainedNullCells = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user