/** * Set the column of the first cell that contains the hyperlink * * @param col the 0-based column of the first cell that contains the hyperlink */ @Override public void setFirstColumn(int col) { setCellReference(new CellReference( getFirstRow(), col )); }
/** * Set the row of the first cell that contains the hyperlink * * @param row the 0-based row of the first cell that contains the hyperlink */ @Override public void setFirstRow(int row) { setCellReference(new CellReference( row, getFirstColumn() )); }
@Internal public void setCellReference(CellReference ref) { setCellReference(ref.formatAsString()); }
/** * Assign a hyperlink to this cell. If the supplied hyperlink is null, the * hyperlink for this cell will be removed. * * @param hyperlink the hyperlink to associate with this cell */ @Override public void setHyperlink(Hyperlink hyperlink) { if (hyperlink == null) { removeHyperlink(); return; } XSSFHyperlink link = (XSSFHyperlink)hyperlink; // Assign to us link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists getSheet().addHyperlink(link); }
/*package*/ static void updateHyperlinks(Sheet sheet, FormulaShifter formulaShifter) { int sheetIndex = sheet.getWorkbook().getSheetIndex(sheet); List<? extends Hyperlink> hyperlinkList = sheet.getHyperlinkList(); for (Hyperlink hyperlink : hyperlinkList) { XSSFHyperlink xhyperlink = (XSSFHyperlink) hyperlink; String cellRef = xhyperlink.getCellRef(); CellRangeAddress cra = CellRangeAddress.valueOf(cellRef); CellRangeAddress shiftedRange = BaseRowColShifter.shiftRange(formulaShifter, cra, sheetIndex); if (shiftedRange != null && shiftedRange != cra) { // shiftedRange should not be null. If shiftedRange is null, that means // that a hyperlink wasn't deleted at the beginning of shiftRows when // identifying rows that should be removed because they will be overwritten xhyperlink.setCellReference(shiftedRange.formatAsString()); } } }
/** * Assign a hyperlink to this cell. If the supplied hyperlink is null, the * hyperlink for this cell will be removed. * * @param link hyperlink associated with this cell */ @Override public void setHyperlink(Hyperlink link) { if (link == null) { removeHyperlink(); return; } setProperty(Property.HYPERLINK,link); XSSFHyperlink xssfobj = (XSSFHyperlink)link; // Assign to us CellReference ref = new CellReference(getRowIndex(), getColumnIndex()); xssfobj.setCellReference( ref ); // Add to the lists getSheet()._sh.addHyperlink(xssfobj); }
/** * Create a new XSSFHyperlink. This method is for Internal use only. * XSSFHyperlinks can be created by {@link XSSFCreationHelper}. * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a> * for an example. * * @param other the hyperlink to copy */ @Internal //FIXME: change to protected if/when SXSSFHyperlink class is created public XSSFHyperlink(Hyperlink other) { if (other instanceof XSSFHyperlink) { XSSFHyperlink xlink = (XSSFHyperlink) other; _type = xlink.getType(); _location = xlink._location; _externalRel = xlink._externalRel; _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy(); } else { _type = other.getType(); _location = other.getAddress(); _externalRel = null; _ctHyperlink = CTHyperlink.Factory.newInstance(); setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn())); } } /**
public void setHyperlink(Hyperlink hyperlink) { XSSFHyperlink link = (XSSFHyperlink)hyperlink; // Assign to us link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists getSheet().addHyperlink(link); }
/** * Set the column of the first cell that contains the hyperlink * * @param col the 0-based column of the first cell that contains the hyperlink */ @Override public void setFirstColumn(int col) { setCellReference(new CellReference( getFirstRow(), col )); }
/** * Set the row of the first cell that contains the hyperlink * * @param row the 0-based row of the first cell that contains the hyperlink */ @Override public void setFirstRow(int row) { setCellReference(new CellReference( row, getFirstColumn() )); }
@Internal public void setCellReference(CellReference ref) { setCellReference(ref.formatAsString()); }
/** * Assign a hypelrink to this cell * * @param hyperlink the hypelrink to associate with this cell */ public void setHyperlink(Hyperlink hyperlink) { XSSFHyperlink link = (XSSFHyperlink)hyperlink; // Assign to us link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists getSheet().addHyperlink(link); }
/** * Assign a hyperlink to this cell. If the supplied hyperlink is null, the * hyperlink for this cell will be removed. * * @param hyperlink the hyperlink to associate with this cell */ @Override public void setHyperlink(Hyperlink hyperlink) { if (hyperlink == null) { removeHyperlink(); return; } XSSFHyperlink link = (XSSFHyperlink)hyperlink; // Assign to us link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists getSheet().addHyperlink(link); }
/*package*/ static void updateHyperlinks(Sheet sheet, FormulaShifter formulaShifter) { int sheetIndex = sheet.getWorkbook().getSheetIndex(sheet); List<? extends Hyperlink> hyperlinkList = sheet.getHyperlinkList(); for (Hyperlink hyperlink : hyperlinkList) { XSSFHyperlink xhyperlink = (XSSFHyperlink) hyperlink; String cellRef = xhyperlink.getCellRef(); CellRangeAddress cra = CellRangeAddress.valueOf(cellRef); CellRangeAddress shiftedRange = BaseRowColShifter.shiftRange(formulaShifter, cra, sheetIndex); if (shiftedRange != null && shiftedRange != cra) { // shiftedRange should not be null. If shiftedRange is null, that means // that a hyperlink wasn't deleted at the beginning of shiftRows when // identifying rows that should be removed because they will be overwritten xhyperlink.setCellReference(shiftedRange.formatAsString()); } } }
/** * Assign a hyperlink to this cell. If the supplied hyperlink is null, the * hyperlink for this cell will be removed. * * @param link hyperlink associated with this cell */ @Override public void setHyperlink(Hyperlink link) { if (link == null) { removeHyperlink(); return; } setProperty(Property.HYPERLINK,link); XSSFHyperlink xssfobj = (XSSFHyperlink)link; // Assign to us CellReference ref = new CellReference(getRowIndex(), getColumnIndex()); xssfobj.setCellReference( ref ); // Add to the lists getSheet()._sh.addHyperlink(xssfobj); }
/** * Create a new XSSFHyperlink. This method is for Internal use only. * XSSFHyperlinks can be created by {@link XSSFCreationHelper}. * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a> * for an example. * * @param other the hyperlink to copy */ @Internal //FIXME: change to protected if/when SXSSFHyperlink class is created public XSSFHyperlink(Hyperlink other) { if (other instanceof XSSFHyperlink) { XSSFHyperlink xlink = (XSSFHyperlink) other; _type = xlink.getType(); _location = xlink._location; _externalRel = xlink._externalRel; _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy(); } else { _type = other.getType(); _location = other.getAddress(); _externalRel = null; _ctHyperlink = CTHyperlink.Factory.newInstance(); setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn())); } } /**