|
|
@@ -26,6 +26,7 @@ import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.TreeMap; |
|
|
|
|
|
|
|
import javax.xml.namespace.QName; |
|
|
@@ -43,16 +44,7 @@ import org.apache.poi.openxml4j.opc.TargetMode; |
|
|
|
import org.apache.poi.ss.SpreadsheetVersion; |
|
|
|
import org.apache.poi.ss.formula.FormulaShifter; |
|
|
|
import org.apache.poi.ss.formula.SheetNameFormatter; |
|
|
|
import org.apache.poi.ss.usermodel.Cell; |
|
|
|
import org.apache.poi.ss.usermodel.CellRange; |
|
|
|
import org.apache.poi.ss.usermodel.CellStyle; |
|
|
|
import org.apache.poi.ss.usermodel.DataValidation; |
|
|
|
import org.apache.poi.ss.usermodel.DataValidationHelper; |
|
|
|
import org.apache.poi.ss.usermodel.Footer; |
|
|
|
import org.apache.poi.ss.usermodel.Header; |
|
|
|
import org.apache.poi.ss.usermodel.IndexedColors; |
|
|
|
import org.apache.poi.ss.usermodel.Row; |
|
|
|
import org.apache.poi.ss.usermodel.Sheet; |
|
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
|
import org.apache.poi.ss.util.AreaReference; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddressList; |
|
|
@@ -70,48 +62,7 @@ import org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter; |
|
|
|
import org.apache.xmlbeans.XmlException; |
|
|
|
import org.apache.xmlbeans.XmlOptions; |
|
|
|
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBreak; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDataValidation; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDataValidations; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDrawing; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTLegacyDrawing; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMergeCell; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMergeCells; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTOutlinePr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageBreak; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageMargins; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageSetUpPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPane; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPrintOptions; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSelection; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetCalcPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetProtection; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetView; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetViews; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTablePart; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableParts; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCalcMode; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellFormulaType; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPaneState; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnsignedShortHex; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorksheetDocument; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* High level representation of a SpreadsheetML worksheet. |
|
|
@@ -1595,6 +1546,33 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { |
|
|
|
worksheet.unsetMergeCells(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Removes a number of merged regions of cells (hence letting them free) |
|
|
|
* |
|
|
|
* This method can be used to bulk-remove merged regions in a way |
|
|
|
* much faster than calling removeMergedRegion() for every single |
|
|
|
* merged region. |
|
|
|
* |
|
|
|
* @param indices A set of the regions to unmerge |
|
|
|
*/ |
|
|
|
public void removeMergedRegions(Set<Integer> indices) { |
|
|
|
CTMergeCells ctMergeCells = worksheet.getMergeCells(); |
|
|
|
|
|
|
|
int size = ctMergeCells.sizeOfMergeCellArray(); |
|
|
|
CTMergeCell[] mergeCellsArray = new CTMergeCell[size - indices.size()]; |
|
|
|
for (int i = 0, d = 0 ; i < size ; i++) { |
|
|
|
if(!indices.contains(i)) { |
|
|
|
mergeCellsArray[d] = ctMergeCells.getMergeCellArray(i); |
|
|
|
d++; |
|
|
|
} |
|
|
|
} |
|
|
|
if(mergeCellsArray.length > 0){ |
|
|
|
ctMergeCells.setMergeCellArray(mergeCellsArray); |
|
|
|
} else{ |
|
|
|
worksheet.unsetMergeCells(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Remove a row from this sheet. All cells contained in the row are removed as well |