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


Java SXSSFCell.setCellValue方法代码示例

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


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

示例1: SegmentationExcelWriter

import org.apache.poi.xssf.streaming.SXSSFCell; //导入方法依赖的package包/类
/**
 * Istanzia oggetto
 *
 * @param se segment engine
 */
public SegmentationExcelWriter(SegmentEngine se) {
    sheetCellIndex = new LinkedHashMap<>();
    wb = new SXSSFWorkbook();
    sheetResults = wb.createSheet("Results");
    headerResults = sheetResults.createRow(0);
    SXSSFCell fCell = headerResults.createCell(0);
    fCell.setCellValue("File Name");
    fCell = headerResults.createCell(1);
    fCell.setCellValue("Language");
    fCell = headerResults.createCell(2);
    fCell.setCellValue("Original Text");
    fCell = headerResults.createCell(3);
    fCell.setCellValue("KPI");
    int idxCell = 4;
    for (SegmentConfiguration sc : se.getPatternMatrix()) {
        idxCell = createExcelHeader(wb, headerResults, sheetCellIndex, idxCell, "", sc, sheetResults);
    }
    writeClassificationHeader(wb);
}
 
开发者ID:fiohol,项目名称:theSemProject,代码行数:25,代码来源:SegmentationExcelWriter.java

示例2: writeLink

import org.apache.poi.xssf.streaming.SXSSFCell; //导入方法依赖的package包/类
@Override
public void writeLink(final String text, final String link)
    throws IOException {

  final SXSSFCell cell =
      (SXSSFCell) this.row.createCell(this.colCount++, CellType.FORMULA);
  // final Cell cell = this.row.createCell(this.colCount++);

  if (text != null) {

    if (link != null) {
      cell.setCellFormula("HYPERLINK(\""
          + link.replace("\"", "\"\"") + "\",\"" + text.replace("\"", "\"\"")
          + "\")");
      cell.setCellStyle(this.linkStyle);
    }

    cell.setCellValue(text);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:21,代码来源:XLSXTranslatorOutputFormat.java

示例3: createSegmentHeader

import org.apache.poi.xssf.streaming.SXSSFCell; //导入方法依赖的package包/类
private int createSegmentHeader(SXSSFRow headerResults, Map<String, Integer> cellIndex, int idxCell, SegmentConfiguration sc, String segmentName) {
    SXSSFCell scell = headerResults.createCell(idxCell);
    scell.setCellValue(segmentName);
    cellIndex.put("SEGMENT." + segmentName, idxCell);
    idxCell++;
    List<CaptureConfiguration> captureConfigurations = sc.getCaptureConfigurations();
    List<CaptureConfiguration> segmentCaptureConfigurations = sc.getSentenceCaptureConfigurations();
    idxCell = getCapturesHeader(headerResults, cellIndex, idxCell, segmentName, captureConfigurations, segmentCaptureConfigurations);
    return idxCell;
}
 
开发者ID:fiohol,项目名称:theSemProject,代码行数:11,代码来源:SegmentationExcelWriter.java

示例4: generateTitleRow

import org.apache.poi.xssf.streaming.SXSSFCell; //导入方法依赖的package包/类
/**
 * 生成标题行
 * 
 * @author nan.li
 * @param sheet
 * @param titles
 * @param object
 */
private static void generateTitleRow(SXSSFSheet sheet, String[] titles, CellStyle cellStyle)
{
    SXSSFRow row = sheet.createRow(0);
    for (int i = 0; i < titles.length; i++)
    {
        SXSSFCell cell = row.createCell(i);
        cell.setCellStyle(cellStyle);// 设置元素的风格
        cell.setCellValue(titles[i]);
    }
}
 
开发者ID:lnwazg,项目名称:kit,代码行数:19,代码来源:ExcelUtils.java

示例5: write

import org.apache.poi.xssf.streaming.SXSSFCell; //导入方法依赖的package包/类
@Override
public void write(Object newDAO) throws OfficeWriterException {
	SpreadSheetCellDAO sscd = MSExcelWriter.checkSpreadSheetCellDAO(newDAO);
	String safeSheetName=WorkbookUtil.createSafeSheetName(sscd.getSheetName());
	SXSSFSheet currentSheet=this.currentWorkbook.getSheet(safeSheetName);
	if (currentSheet==null) {// create sheet if it does not exist yet
		currentSheet=this.currentWorkbook.createSheet(safeSheetName);
		if (!(safeSheetName.equals(sscd.getSheetName()))) {
			LOG.warn("Sheetname modified from \""+sscd.getSheetName()+"\" to \""+safeSheetName+"\" to correspond to Excel conventions.");
		}
		// create drawing anchor (needed for comments...)
		this.mappedDrawings.put(safeSheetName,currentSheet.createDrawingPatriarch());
	}
	// check if cell exist
	CellAddress currentCA = new CellAddress(sscd.getAddress());
	SXSSFRow currentRow = currentSheet.getRow(currentCA.getRow());
	if (currentRow==null) { // row does not exist? => create it
		currentRow=currentSheet.createRow(currentCA.getRow());
	}
	SXSSFCell currentCell = currentRow.getCell(currentCA.getColumn());
	if ((currentCell!=null)) { // cell already exists and no template loaded ? => throw exception
		throw new OfficeWriterException("Invalid cell specification: cell already exists at "+currentCA);
	}
	// create cell if no template is loaded or cell not available in template
		currentCell=currentRow.createCell(currentCA.getColumn());		
	// set the values accordingly
	if (!("".equals(sscd.getFormula()))) { // if formula exists then use formula
		currentCell.setCellFormula(sscd.getFormula());
		
	} else {	
	// else use formattedValue
		currentCell.setCellValue(sscd.getFormattedValue());
	}
	// set comment
	if ((sscd.getComment()!=null) && (!("".equals(sscd.getComment())))) {
		/** the following operations are necessary to create comments **/
		/** Define size of the comment window **/
		    ClientAnchor anchor = this.currentWorkbook.getCreationHelper().createClientAnchor();
    		    anchor.setCol1(currentCell.getColumnIndex());
    		    anchor.setCol2(currentCell.getColumnIndex()+this.howc.getCommentWidth());
    		    anchor.setRow1(currentRow.getRowNum());
    		    anchor.setRow2(currentRow.getRowNum()+this.howc.getCommentHeight());
		/** create comment **/
		   Comment currentComment = mappedDrawings.get(safeSheetName).createCellComment(anchor);
    		    currentComment.setString(this.currentWorkbook.getCreationHelper().createRichTextString(sscd.getComment()));
    		    currentComment.setAuthor(this.howc.getCommentAuthor());
		    currentCell.setCellComment(currentComment);

	}
	}
 
开发者ID:ZuInnoTe,项目名称:hadoopoffice,代码行数:51,代码来源:MSExcelLowFootprintWriter.java


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