Example usage for org.apache.poi.ss.formula.ptg Area3DPxg setLastSheetName

List of usage examples for org.apache.poi.ss.formula.ptg Area3DPxg setLastSheetName

Introduction

In this page you can find the example usage for org.apache.poi.ss.formula.ptg Area3DPxg setLastSheetName.

Prototype

public void setLastSheetName(String sheetName) 

Source Link

Usage

From source file:org.tiefaces.components.websheet.utility.ShiftFormulaUtility.java

License:MIT License

/**
 * Builds the dynamic row for area ptg base.
 *
 * @param ptg//from w w  w .ja  v  a 2  s .c  o  m
 *            the ptg
 * @param originalOperandClass
 *            the original operand class
 * @param rowList
 *            the row list
 * @param newPtg
 *            the new ptg
 */
private static void buildDynamicRowForAreaPtgBase(final Object ptg, final byte originalOperandClass,
        final List<SerialRow> rowList, final Ptg[] newPtg) {
    AreaPtgBase areaPtg = (AreaPtgBase) ptg;
    int originFirstRow = areaPtg.getFirstRow();
    int originLastRow = areaPtg.getLastRow();
    int unitSize = 2;
    for (int i = 0; i < rowList.size(); i++) {
        Row row = rowList.get(i).getRow();
        int shiftRow = row.getRowNum() - originFirstRow;
        if (ptg instanceof Area3DPxg) {
            Area3DPxg area3dPxg = (Area3DPxg) ptg;
            Area3DPxg new3dpxg = new Area3DPxg(area3dPxg.getExternalWorkbookNumber(),
                    new SheetIdentifier(null, new NameIdentifier(area3dPxg.getSheetName(), false)),
                    area3dPxg.format2DRefAsString());
            new3dpxg.setClass(originalOperandClass);
            new3dpxg.setFirstColRelative(area3dPxg.isFirstColRelative());
            new3dpxg.setLastColRelative(area3dPxg.isLastColRelative());
            new3dpxg.setFirstRow(originFirstRow + shiftRow);
            new3dpxg.setLastRow(originLastRow + shiftRow);
            new3dpxg.setFirstRowRelative(area3dPxg.isFirstRowRelative());
            new3dpxg.setLastRowRelative(area3dPxg.isLastRowRelative());
            new3dpxg.setLastSheetName(area3dPxg.getLastSheetName());
            newPtg[i * unitSize] = new3dpxg;
        } else {
            AreaPtgBase areaPtgBase = (AreaPtgBase) ptg;
            newPtg[i * unitSize] = new AreaPtg(originFirstRow + shiftRow, originLastRow + shiftRow,
                    areaPtgBase.getFirstColumn(), areaPtgBase.getLastColumn(), areaPtgBase.isFirstRowRelative(),
                    areaPtgBase.isLastRowRelative(), areaPtgBase.isFirstColRelative(),
                    areaPtgBase.isLastColRelative());

        }
        if (i < (rowList.size() - 1)) {
            newPtg[i * unitSize + 1] = ParenthesisPtg.instance;
        }
    }
}