Example usage for org.apache.poi.ss.usermodel Workbook createName

List of usage examples for org.apache.poi.ss.usermodel Workbook createName

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Workbook createName.

Prototype

Name createName();

Source Link

Document

Creates a new (uninitialised) defined name in this workbook

Usage

From source file:org.formulacompiler.spreadsheet.internal.excel.xls.saver.ExcelXLSSaver.java

License:Open Source License

private void saveNames(BaseSpreadsheet _wb, Workbook _xwb) {
    for (final Entry<String, CellRange> nd : _wb.getModelRangeNames().entrySet()) {
        final String name = nd.getKey();
        final CellRange ref = nd.getValue();
        final CellIndex from = ref.getFrom();
        final CellIndex to = ref.getTo();
        if (from.getSheetIndex() == to.getSheetIndex()) {
            final Name namedCel = _xwb.createName();
            namedCel.setNameName(name);/*from  w w w .  j a  v  a2 s  .c o  m*/
            namedCel.setRefersToFormula(ref.toString());
        }
    }
}