/** * Convenience constructor for creating a <tt>CellRangeAddressList</tt> with a single * <tt>CellRangeAddress</tt>. Other <tt>CellRangeAddress</tt>es may be added later. */ public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) { this(); addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); } /**
/** * Add a cell range structure. * * @param firstRow - the upper left hand corner's row * @param firstCol - the upper left hand corner's col * @param lastRow - the lower right hand corner's row * @param lastCol - the lower right hand corner's col */ public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol) { CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); addCellRangeAddress(region); } public void addCellRangeAddress(CellRangeAddress cra) {
public CellRangeAddressList copy() { CellRangeAddressList result = new CellRangeAddressList(); int nItems = _list.size(); for (int k = 0; k < nItems; k++) { CellRangeAddress region = _list.get(k); result.addCellRangeAddress(region.copy()); } return result; } public CellRangeAddress[] getCellRangeAddresses() {
/** * Set cell ranges list to a single cell range and * modify the enclosing cell range accordingly. * @param cellRanges - list of CellRange objects */ public void setCellRanges(CellRangeAddress[] cellRanges) { if(cellRanges == null) { throw new IllegalArgumentException("cellRanges must not be null"); } CellRangeAddressList cral = new CellRangeAddressList(); CellRangeAddress enclosingRange = null; for (CellRangeAddress cr : cellRanges) { enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange); cral.addCellRangeAddress(cr); } field_3_enclosing_cell_range = enclosingRange; field_4_cell_ranges = cral; }
@Override public List<XSSFDataValidation> getDataValidations() { List<XSSFDataValidation> xssfValidations = new ArrayList<>(); CTDataValidations dataValidations = this.worksheet.getDataValidations(); if( dataValidations!=null && dataValidations.getCount() > 0 ) { for (CTDataValidation ctDataValidation : dataValidations.getDataValidationArray()) { CellRangeAddressList addressList = new CellRangeAddressList(); @SuppressWarnings("unchecked") List<String> sqref = ctDataValidation.getSqref(); for (String stRef : sqref) { String[] regions = stRef.split(" "); for (String region : regions) { String[] parts = region.split(":"); CellReference begin = new CellReference(parts[0]); CellReference end = parts.length > 1 ? new CellReference(parts[1]) : begin; CellRangeAddress cellRangeAddress = new CellRangeAddress(begin.getRow(), end.getRow(), begin.getCol(), end.getCol()); addressList.addCellRangeAddress(cellRangeAddress); } } XSSFDataValidation xssfDataValidation = new XSSFDataValidation(addressList, ctDataValidation); xssfValidations.add(xssfDataValidation); } } return xssfValidations; }
/** * Convenience constructor for creating a <tt>CellRangeAddressList</tt> with a single * <tt>CellRangeAddress</tt>. Other <tt>CellRangeAddress</tt>es may be added later. */ public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) { this(); addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); } /**
/** * Convenience constructor for creating a <tt>CellRangeAddressList</tt> with a single * <tt>CellRangeAddress</tt>. Other <tt>CellRangeAddress</tt>es may be added later. */ public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) { this(); addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); } /**
/** * Convenience constructor for creating a <tt>CellRangeAddressList</tt> with a single * <tt>CellRangeAddress</tt>. Other <tt>CellRangeAddress</tt>es may be added later. */ public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol) { this(); addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); } /**
/** * Add a cell range structure. * * @param firstRow - the upper left hand corner's row * @param firstCol - the upper left hand corner's col * @param lastRow - the lower right hand corner's row * @param lastCol - the lower right hand corner's col */ public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol) { CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); addCellRangeAddress(region); } public void addCellRangeAddress(CellRangeAddress cra) {
/** * Add a cell range structure. * * @param firstRow - the upper left hand corner's row * @param firstCol - the upper left hand corner's col * @param lastRow - the lower right hand corner's row * @param lastCol - the lower right hand corner's col */ public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol) { CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); addCellRangeAddress(region); } public void addCellRangeAddress(CellRangeAddress cra) {
/** * Add a cell range structure. * * @param firstRow - the upper left hand corner's row * @param firstCol - the upper left hand corner's col * @param lastRow - the lower right hand corner's row * @param lastCol - the lower right hand corner's col */ public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol) { CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); addCellRangeAddress(region); } public void addCellRangeAddress(CellRangeAddress cra) {
public CellRangeAddressList copy() { CellRangeAddressList result = new CellRangeAddressList(); int nItems = _list.size(); for (int k = 0; k < nItems; k++) { CellRangeAddress region = _list.get(k); result.addCellRangeAddress(region.copy()); } return result; } public CellRangeAddress[] getCellRangeAddresses() {
public CellRangeAddressList copy() { CellRangeAddressList result = new CellRangeAddressList(); int nItems = _list.size(); for (int k = 0; k < nItems; k++) { CellRangeAddress region = (CellRangeAddress) _list.get(k); result.addCellRangeAddress(region.copy()); } return result; } public CellRangeAddress[] getCellRangeAddresses() {
public CellRangeAddressList copy() { CellRangeAddressList result = new CellRangeAddressList(); int nItems = _list.size(); for (int k = 0; k < nItems; k++) { CellRangeAddress region = (CellRangeAddress) _list.get(k); result.addCellRangeAddress(region.copy()); } return result; } public CellRangeAddress[] getCellRangeAddresses() {
/** * Set cell ranges list to a single cell range and * modify the enclosing cell range accordingly. * @param cellRanges - list of CellRange objects */ public void setCellRanges(CellRangeAddress[] cellRanges) { if(cellRanges == null) { throw new IllegalArgumentException("cellRanges must not be null"); } CellRangeAddressList cral = new CellRangeAddressList(); CellRangeAddress enclosingRange = null; for (CellRangeAddress cr : cellRanges) { enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange); cral.addCellRangeAddress(cr); } field_3_enclosing_cell_range = enclosingRange; field_4_cell_ranges = cral; }
/** * Set cell ranges list to a single cell range and * modify the enclosing cell range accordingly. * @param cellRanges - list of CellRange objects */ public void setCellRanges(CellRangeAddress[] cellRanges) { if(cellRanges == null) { throw new IllegalArgumentException("cellRanges must not be null"); } CellRangeAddressList cral = new CellRangeAddressList(); CellRangeAddress enclosingRange = null; for (int i = 0; i < cellRanges.length; i++) { CellRangeAddress cr = cellRanges[i]; enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange); cral.addCellRangeAddress(cr); } field_3_enclosing_cell_range = enclosingRange; field_4_cell_ranges = cral; }
/** * Set cell ranges list to a single cell range and * modify the enclosing cell range accordingly. * @param cellRanges - list of CellRange objects */ public void setCellRanges(CellRangeAddress[] cellRanges) { if(cellRanges == null) { throw new IllegalArgumentException("cellRanges must not be null"); } CellRangeAddressList cral = new CellRangeAddressList(); CellRangeAddress enclosingRange = null; for (int i = 0; i < cellRanges.length; i++) { CellRangeAddress cr = cellRanges[i]; enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange); cral.addCellRangeAddress(cr); } field_3_enclosing_cell_range = enclosingRange; field_4_cell_ranges = cral; }
@Override public List<XSSFDataValidation> getDataValidations() { List<XSSFDataValidation> xssfValidations = new ArrayList<>(); CTDataValidations dataValidations = this.worksheet.getDataValidations(); if( dataValidations!=null && dataValidations.getCount() > 0 ) { for (CTDataValidation ctDataValidation : dataValidations.getDataValidationArray()) { CellRangeAddressList addressList = new CellRangeAddressList(); @SuppressWarnings("unchecked") List<String> sqref = ctDataValidation.getSqref(); for (String stRef : sqref) { String[] regions = stRef.split(" "); for (String region : regions) { String[] parts = region.split(":"); CellReference begin = new CellReference(parts[0]); CellReference end = parts.length > 1 ? new CellReference(parts[1]) : begin; CellRangeAddress cellRangeAddress = new CellRangeAddress(begin.getRow(), end.getRow(), begin.getCol(), end.getCol()); addressList.addCellRangeAddress(cellRangeAddress); } } XSSFDataValidation xssfDataValidation = new XSSFDataValidation(addressList, ctDataValidation); xssfValidations.add(xssfDataValidation); } } return xssfValidations; }
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support public List<XSSFDataValidation> getDataValidations() { List<XSSFDataValidation> xssfValidations = new ArrayList<XSSFDataValidation>(); CTDataValidations dataValidations = this.worksheet.getDataValidations(); if( dataValidations!=null && dataValidations.getCount() > 0 ) { for (CTDataValidation ctDataValidation : dataValidations.getDataValidationArray()) { CellRangeAddressList addressList = new CellRangeAddressList(); @SuppressWarnings("unchecked") List<String> sqref = ctDataValidation.getSqref(); for (String stRef : sqref) { String[] regions = stRef.split(" "); for (int i = 0; i < regions.length; i++) { String[] parts = regions[i].split(":"); CellReference begin = new CellReference(parts[0]); CellReference end = parts.length > 1 ? new CellReference(parts[1]) : begin; CellRangeAddress cellRangeAddress = new CellRangeAddress(begin.getRow(), end.getRow(), begin.getCol(), end.getCol()); addressList.addCellRangeAddress(cellRangeAddress); } } XSSFDataValidation xssfDataValidation = new XSSFDataValidation(addressList, ctDataValidation); xssfValidations.add(xssfDataValidation); } } return xssfValidations; }
newCellRangeAddressList.addCellRangeAddress(rowStartIndex, configColIndex, sheet.getLastRowNum(), configColIndex); validationContains = true; int i = templateRowEndIndex; for (; i < count; i++) { newCellRangeAddressList.addCellRangeAddress(start + i * step, configColIndex, end + i * step, configColIndex); validationContains = true; long _end = end + i * step; _end = _end < lastRow ? _end : lastRow; newCellRangeAddressList.addCellRangeAddress((int) _start, configColIndex, (int) _end, configColIndex); validationContains = true;