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


Java XSSFComment类代码示例

本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFComment的典型用法代码示例。如果您正苦于以下问题:Java XSSFComment类的具体用法?Java XSSFComment怎么用?Java XSSFComment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XSSFComment类属于org.apache.poi.xssf.usermodel包,在下文中一共展示了XSSFComment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的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: outputEmptyCellComment

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
/**
 * Output an empty-cell comment.
 * 
 * @throws BingSaxReadStopException
 */
private void outputEmptyCellComment(CellReference cellRef)
		throws BingSaxReadStopException {
	String cellRefString = cellRef.formatAsString();
	XSSFComment comment = commentsTable.findCellComment(cellRefString);
	output.cell(rowNum, cellRefString, null, comment);
}
 
开发者ID:bingyulei007,项目名称:bingexcel,代码行数:12,代码来源:ExcelXSSFSheetXMLHandler.java

示例3: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
public void cell(String cellRef, String formattedValue) {
  try {
    xhtml.startElement("td");

    // Main cell contents
    xhtml.characters(formattedValue);

    // Comments
    if (comments != null) {
      XSSFComment comment = comments.findCellComment(cellRef);
      if (comment != null) {
        xhtml.startElement("br");
        xhtml.endElement("br");
        xhtml.characters(comment.getAuthor());
        xhtml.characters(": ");
        xhtml.characters(comment.getString().getString());
      }
    }

    xhtml.endElement("td");
  } catch (SAXException e) {
  }
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:24,代码来源:XSSFExcelExtractorDecorator.java

示例4: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
    if (this.currentRow < noOfRowsToSkip)
        return;

    if (formattedValue == null || formattedValue.length() == 0)
        return;

    // Handle the Header Row
    if (this.verifyHeader && this.headerRow == this.currentRow) {
        this.saveHeaderCellValue(cellReference, formattedValue);
    } else {
        this.saveRowCellValue(cellReference, formattedValue);
    }
    
}
 
开发者ID:millij,项目名称:excel-object-mapper,代码行数:17,代码来源:ExcelSheetContentsHandler.java

示例5: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的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

示例6: build

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
public static MethodSpec build(List<ColumnInfoType> columns) {
    final CodeBlock.Builder builder = CodeBlock.builder();
    LoggerFactory.getLogger(ZeroCellAnnotationProcessor.class)
                 .info("Found {} columns in source class", columns.size());
    columns.forEach(column -> {
        String staticFieldName = "COL_" + column.getName();
        String fieldName = column.getFieldName();

        String beanSetterProperty = beanSetterPropertyName(fieldName);

        builder.beginControlFlow("if ($L == column)", staticFieldName)
            .addStatement("assertColumnName($S, formattedValue)", column.getName());

        converterStatementFor(builder, column, beanSetterProperty);

        builder.addStatement("return").endControlFlow();
    });

    return  MethodSpec.methodBuilder("cell")
            .addAnnotation(Override.class)
            .addModifiers(Modifier.PUBLIC)
            .addParameter(String.class, "cellReference")
            .addParameter(String.class, "formattedValue", Modifier.FINAL)
            .addParameter(XSSFComment.class, "xssfComment", Modifier.FINAL)
            .addStatement("if (java.util.Objects.isNull(cur)) return")
            .addComment("Gracefully handle missing CellRef here in a similar way as XSSFCell does")
            .beginControlFlow("if(cellReference == null)")
            .addStatement("cellReference = new $T(currentRow, currentCol).formatAsString()", org.apache.poi.ss.util.CellAddress.class)
            .endControlFlow()
            .addStatement("int column = new $T(cellReference).getCol()", org.apache.poi.hssf.util.CellReference.class)
            .addStatement("currentCol = column")
            .addCode(builder.build())
            .build();
}
 
开发者ID:creditdatamw,项目名称:zerocell,代码行数:35,代码来源:CellMethodSpec.java

示例7: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue, XSSFComment xssfComment) {
    // gracefully handle missing CellRef here in a similar way as XSSFCell does
    if(cellReference == null) {
        cellReference = new CellAddress(currentRow, currentCol).formatAsString();
    }

    int column = new CellReference(cellReference).getCol();
    currentCol = column;

    // We ignore additional cells here since we only care about the cells
    // in the columns array i.e. the defined columns
    if (column > MAXIMUM_COL_INDEX) {
        LOGGER.warn("Invalid Column index found: " + column);
        return;
    }

    ColumnInfo currentColumnInfo = columns[column];

    if (isHeaderRow) {
        if (! currentColumnInfo.getName().equalsIgnoreCase(formattedValue.trim())){
            throw new ZeroCellException(String.format("Expected Column '%s' but found '%s'", currentColumnInfo.getName(), formattedValue));
        }
    }
    // Prevent from trying to write to a null instance
    if (Objects.isNull(cur)) return;
    writeColumnField(cur, formattedValue, currentColumnInfo, currentRow);
}
 
开发者ID:creditdatamw,项目名称:zerocell,代码行数:29,代码来源:EntityHandler.java

示例8: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
    if (firstCellOfRow) {
        firstCellOfRow = false;
    } else {
        _resultRowTmp.append(ExcelValidator.FIELD_SPLIT);
    }

    // gracefully handle missing CellRef here in a similar way as
    // XSSFCell does
    if (cellReference == null) {
        cellReference = new CellAddress(currentRow, currentCol).formatAsString();
    }

    // Did we miss any cells?
    int thisCol = (new CellReference(cellReference)).getCol();
    int missedCols = thisCol - currentCol - 1;
    for (int i = 0; i < missedCols; i++) {
        _resultRowTmp.append(ExcelValidator.FIELD_SPLIT);
    }
    currentCol = thisCol;

    // Number or string?
    try {
        Double.parseDouble(formattedValue);
        _resultRowTmp.append(formattedValue);
    } catch (NumberFormatException e) {
        _resultRowTmp.append(formattedValue);
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:30,代码来源:XLSX2CSV.java

示例9: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
    if (this.isNewRow) {
        this.isNewRow = false;
    }
    // gracefully handle missing CellRef here in a similar way as XSSFCell does
    if (cellReference == null) {
        cellReference = new CellAddress(this.currentRowInSheet, this.currentColInRow).formatAsString();
    }
    // 获取cellReference指向的列数,0-based
    int thisCol = (new CellReference(cellReference)).getCol();
    this.currentColInRow = thisCol;
    if (formattedValue == null || formattedValue.isEmpty()) {
        return;
    }
    if (this.currentRowInSheet == 0) {
        //标题行
        if (this.currentSheetInExcel == 0) {
            //若是第0个Sheet则添加标题,0-based
            this.titles.add(formattedValue);
        }
        return;
    }
    if (this.currentRowInSheet == 1) {
        //列名行
        if (this.currentSheetInExcel == 0) {
            //若是第0个Sheet则添加列名,0-based
            this.columns.add(formattedValue);
        }
        return;
    }
    //数据行
    String key = this.columns.get(this.currentColInRow);
    Object value = this.getValue(formattedValue);
    this.data.put(key, value);
}
 
开发者ID:FlyingHe,项目名称:UtilsMaven,代码行数:37,代码来源:XLSXReader.java

示例10: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
/**
 * POI calls this with the value parsed from the cell.
 * @param cellReference The cell reference
 * @param formattedValue The value of the cell
 * @param comment a comment
 */
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
    this.output.valueParsed(formattedValue);
    int thisCol = (new CellReference(cellReference)).getCol();

    //Fill missing columns
    int missedCols = thisCol - currentCol - 1;
    for (int i=0; i<missedCols; i++) {
        this.output.valueParsed("");
    }
    currentCol = thisCol;
}
 
开发者ID:zavtech,项目名称:morpheus-core,代码行数:19,代码来源:ExcelSource.java

示例11: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
	if (firstCellOfRow) {
		firstCellOfRow = false;
	} else {
		_resultRowTmp.append(ExcelValidator.FIELD_SPLIT);
	}

	// gracefully handle missing CellRef here in a similar way as
	// XSSFCell does
	if (cellReference == null) {
		cellReference = new CellAddress(currentRow, currentCol).formatAsString();
	}

	// Did we miss any cells?
	int thisCol = (new CellReference(cellReference)).getCol();
	int missedCols = thisCol - currentCol - 1;
	for (int i = 0; i < missedCols; i++) {
		_resultRowTmp.append(ExcelValidator.FIELD_SPLIT);
	}
	currentCol = thisCol;

	// Number or string?
	try {
		Double.parseDouble(formattedValue);
		_resultRowTmp.append(formattedValue);
	} catch (NumberFormatException e) {
		_resultRowTmp.append(formattedValue);
	}
}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:30,代码来源:XLSX2CSV.java

示例12: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
@Override
public void cell(int rowNum, String cellReference,
		String formattedValue, XSSFComment comment)
		 {
	
	if (!Strings.isNullOrEmpty(formattedValue)) {
		int column = nameToColumn(cellReference);
		rowList.add(new CellKV<String>(column, formattedValue));
	}
	
}
 
开发者ID:bingyulei007,项目名称:bingexcel,代码行数:12,代码来源:DefaultXSSFSaxHandler.java

示例13: cell

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
@Override
public void cell(String cellReference, String formattedValue,XSSFComment comment) {
	if(currentOutputRow!=-1){
		CellReference ref = new CellReference(cellReference);
		int col = ref.getCol();
		if(col < table.getColumnCount()){
			table.setValueAt(formattedValue, currentOutputRow, col);					
		}
	}
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:11,代码来源:XmlParserLoader.java

示例14: outputEmptyCellComment

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
/**
 * Output an empty-cell comment.
 */
private void outputEmptyCellComment(CellAddress cellRef) {
    XSSFComment comment = commentsTable.findCellComment(cellRef);
    output.cell(cellRef.formatAsString(), null, comment);
}
 
开发者ID:FlyingHe,项目名称:UtilsMaven,代码行数:8,代码来源:XSSFSheetXMLHandlerPlus.java

示例15: generateXSSFColumnMetadata

import org.apache.poi.xssf.usermodel.XSSFComment; //导入依赖的package包/类
private String generateXSSFColumnMetadata(StringBuffer rdfText, boolean firstItem, URI baseRDFURI, int columnIndex, XSSFCell titleCell, XSSFComment summaryCell, XSSFCell valueCell)
{
    if ((titleCell != null) && (titleCell.getCellType() == XSSFCell.CELL_TYPE_STRING))
    {
        String columnId      = UUID.randomUUID().toString();
        String columnLabel   = removeRowNumber(titleCell.getReference());
        String columnName    = titleCell.getStringCellValue();
        String columnComment = null;
        if (titleCell.getCellComment() != null)
            columnComment = titleCell.getCellComment().getString().getString();
        String columnType = null;
        if (valueCell != null)
        {
            if (valueCell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC)
                columnType =  "Number";
            else if (valueCell.getCellType() == XSSFCell.CELL_TYPE_STRING)
                columnType =  "String";
            else if (valueCell.getCellType() == XSSFCell.CELL_TYPE_BOOLEAN)
                columnType =  "Boolean";
        }

        if (firstItem)
            firstItem = false;
        else
            rdfText.append('\n');

        rdfText.append("    <x:Column rdf:about=\"");
        rdfText.append(baseRDFURI.resolve('#' + columnId));
        rdfText.append("\">\n");
        rdfText.append("        <x:hasLabel>");
        rdfText.append(escapeXml10(columnLabel));
        rdfText.append("</x:hasLabel>\n");
        rdfText.append("        <x:hasIndex>");
        rdfText.append(columnIndex);
        rdfText.append("</x:hasIndex>\n");
        if (columnType != null)
        {
            rdfText.append("        <x:hasType>");
            rdfText.append(escapeXml10(columnType));
            rdfText.append("</x:hasType>\n");
        }
        if (columnName != null)
        {
            rdfText.append("        <d:hasTitle>");
            rdfText.append(escapeXml10(columnName));
            rdfText.append("</d:hasTitle>\n");
        }
        if (columnComment != null)
        {
            rdfText.append("        <d:hasSummary>");
            rdfText.append(escapeXml10(columnComment));
            rdfText.append("</d:hasSummary>\n");
        }
        rdfText.append("    </x:Column>\n");

        return columnId;
    }
    else
        return null;
}
 
开发者ID:arjuna-technologies,项目名称:Metadata_Utilities,代码行数:61,代码来源:XSSFSpreadsheetMetadataGenerator.java


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