当前位置: 首页>>代码示例>>Java>>正文


Java CellAddress.getColumn方法代码示例

本文整理汇总了Java中org.apache.poi.ss.util.CellAddress.getColumn方法的典型用法代码示例。如果您正苦于以下问题:Java CellAddress.getColumn方法的具体用法?Java CellAddress.getColumn怎么用?Java CellAddress.getColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.ss.util.CellAddress的用法示例。


在下文中一共展示了CellAddress.getColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cell

import org.apache.poi.ss.util.CellAddress; //导入方法依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
	// create empty column, if needed
	
	CellAddress currentCellAddress = new CellAddress(cellReference);
	for (int i=this.currentColumn;i<currentCellAddress.getColumn();i++) {
		this.spreadSheetCellDAOCurrentRow.add(null);
		this.currentColumn++;
	}
	// add column
	SpreadSheetCellDAO currentDAO = null;
	if (comment!=null) {
		currentDAO = new SpreadSheetCellDAO(formattedValue,comment.getString().getString(), "", cellReference,this.sheetName);
	} else {
		currentDAO = new SpreadSheetCellDAO(formattedValue,"", "", cellReference,this.sheetName);
	}
	this.currentColumn++;
	this.spreadSheetCellDAOCurrentRow.add(currentDAO);
}
 
开发者ID:ZuInnoTe,项目名称:hadoopoffice,代码行数:20,代码来源:MSExcelLowFootprintParser.java

示例2: cell

import org.apache.poi.ss.util.CellAddress; //导入方法依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {

    CellAddress cellAddress = new CellAddress(cellReference);
    int row = cellAddress.getRow();

    if (row + 1 <= options.skip()) {
        return;
    }

    internalCount = row;
    int column = cellAddress.getColumn();
    setFieldValue(formattedValue, type, column);
}
 
开发者ID:ozlerhakan,项目名称:poiji,代码行数:15,代码来源:PoijiHandler.java

示例3: asTable

import org.apache.poi.ss.util.CellAddress; //导入方法依赖的package包/类
@Documentation(
    value = "Insert a table from an Excel .xlsx file.",
    params = {
        @Param(name = "uri", value = "The Excel .xlsx file uri, it can be relative to the template"),
        @Param(name = "sheetName", value = "The sheet name"),
        @Param(name = "topLeftCellAdress", value = "The top left cell address"),
        @Param(name = "bottomRightCellAdress", value = "The bottom right cell address"),
        @Param(name = "languageTag", value = "The language tag for the locale"),
    },
    result = "insert the table",
    examples = {
        @Example(expression = "'excel.xlsx'.asTable('Feuil1', 'C3', 'F7', 'fr-FR')", result = "insert the table from 'excel.xlsx'"),
    }
)
// @formatter:on
public MTable asTable(String uriStr, String sheetName, String topLeftCellAdress, String bottomRightCellAdress,
        String languageTag) throws IOException {
    final MTable res = new MTableImpl();

    final URI xlsxURI = URI.createURI(uriStr, false);
    final URI uri = xlsxURI.resolve(templateURI);

    try (XSSFWorkbook workbook = new XSSFWorkbook(uriConverter.createInputStream(uri));) {
        final FormulaEvaluator evaluator = new XSSFFormulaEvaluator(workbook);
        final XSSFSheet sheet = workbook.getSheet(sheetName);
        if (sheet == null) {
            throw new IllegalArgumentException(String.format("The sheet %s doesn't exists in %s.", sheetName, uri));
        } else {
            final Locale locale;
            if (languageTag != null) {
                locale = Locale.forLanguageTag(languageTag);
            } else {
                locale = Locale.getDefault();
            }
            final DataFormatter dataFormatter = new DataFormatter(locale);
            final CellAddress start = new CellAddress(topLeftCellAdress);
            final CellAddress end = new CellAddress(bottomRightCellAdress);
            int rowIndex = start.getRow();
            while (rowIndex <= end.getRow()) {
                final XSSFRow row = sheet.getRow(rowIndex++);
                if (row != null) {
                    final MRow mRow = new MRowImpl();
                    int cellIndex = start.getColumn();
                    while (cellIndex <= end.getColumn()) {
                        final XSSFCell cell = row.getCell(cellIndex++);
                        if (cell != null) {
                            final MStyle style = getStyle(cell);
                            final MElement text = new MTextImpl(dataFormatter.formatCellValue(cell, evaluator),
                                    style);
                            final Color background = getColor(cell.getCellStyle().getFillForegroundColorColor());
                            final MCell mCell = new MCellImpl(text, background);
                            mRow.getCells().add(mCell);
                        } else {
                            mRow.getCells().add(createEmptyCell());
                        }
                    }
                    res.getRows().add(mRow);
                } else {
                    final int length = end.getColumn() - start.getColumn() + 1;
                    res.getRows().add(createEmptyRow(length));
                }
            }

        }
    }

    return res;
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:69,代码来源:ExcelServices.java


注:本文中的org.apache.poi.ss.util.CellAddress.getColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。