Example usage for org.apache.poi.ss.util CellReference getCellRefParts

List of usage examples for org.apache.poi.ss.util CellReference getCellRefParts

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellReference getCellRefParts.

Prototype

public String[] getCellRefParts() 

Source Link

Document

Returns the three parts of the cell reference, the Sheet name (or null if none supplied), the 1 based row number, and the A based column letter.

Usage

From source file:com.tikal.tallerWeb.servicio.reporte.cliente.AbstractSeccionXLS.java

License:Apache License

public String getSimpleReference(Cell cell) {
    CellReference reference = new CellReference(cell);
    String[] partsInicio = reference.getCellRefParts();
    return partsInicio[2] + partsInicio[1];
}

From source file:org.paxml.table.excel.ExcelColumn.java

License:Open Source License

public static String getColumnName(int index) {
    CellReference ref = new CellReference(-1, index);
    return ref.getCellRefParts()[1];
}

From source file:uk.ac.manchester.cs.owl.semspreadsheets.model.WorkbookManager.java

License:BSD License

public Set<String> getLinkedCells(String currentSheetName) {
    Set<String> set = new HashSet<>();
    Range selectedRange = getSelectionModel().getSelectedRange();
    String sheetName = getSelectionModel().getSelectedRange().getSheet().getName();
    if (cellTempRef != null && cellTempRef.getSheetName().equals(sheetName)) {
        set.add(cellTempRef.getCellRefParts()[2] + cellTempRef.getCellRefParts()[1] + ",YELLOW,1");
    }/*ww w. j  ava 2 s.c o  m*/
    if (selectedRange.isCellSelection()) {
        for (String entry : linkedCellsSet) {
            CellReference fromCF = new CellReference(entry.split(",")[0]);
            CellReference toCF = new CellReference(entry.split(",")[1]);
            Boolean table = entry.split(",")[2].equals("table");

            if (fromCF.getSheetName().equals(currentSheetName)) {
                if (table) {
                    set.add(fromCF.getCellRefParts()[2] + fromCF.getCellRefParts()[1] + ",BLUE,1");
                } else {
                    set.add(fromCF.getCellRefParts()[2] + fromCF.getCellRefParts()[1] + ",CYAN,1");
                }
            }
            if (toCF.getSheetName().equals(currentSheetName)) {
                if (table) {
                    AreaReference area = getAreaFirstColumn(toCF);
                    int noOfColumns = getAreaFirstColumnNoOfColumns(toCF);
                    for (CellReference cellA : area.getAllReferencedCells()) {
                        set.add(cellA.getCellRefParts()[2] + cellA.getCellRefParts()[1] + ",RED,"
                                + noOfColumns);
                    }
                } else {
                    set.add(toCF.getCellRefParts()[2] + toCF.getCellRefParts()[1] + ",ORANGE,1");
                }
            }
        }
    }
    return set;
}