• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SXSSFCell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SXSSFCell类属于org.apache.poi.xssf.streaming包,在下文中一共展示了SXSSFCell类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例4: 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


示例5: newSXSSFCell

import org.apache.poi.xssf.streaming.SXSSFCell; //导入依赖的package包/类
public static SXSSFCell newSXSSFCell(SXSSFRow row, int index) {
	return (SXSSFCell) row.createCell(index);
}
 
开发者ID:wuwz,项目名称:ExcelKit,代码行数:4,代码来源:POIUtils.java


示例6: 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


示例7: testModifyCellContents

import org.apache.poi.xssf.streaming.SXSSFCell; //导入依赖的package包/类
/**
 * [Flow #-2] 액셀 파일 수정 : 엑샐 파일 내 셀의 내용을 변경하고 저장할 수 있음
 */
@Test
public void testModifyCellContents() throws Exception {
    
    try {
    	String content = "Use \n with word wrap on to create a new line";
    	short rownum = 2;
    	int cellnum = 2;
    	
    	log.debug("testModifyCellContents start....");

    	StringBuffer sb = new StringBuffer();
    	sb.append(fileLocation).append("/").append("testModifyCellContents.xlsx");

    	if (!EgovFileUtil.isExistsFile(sb.toString())) {
    		XSSFWorkbook wbT = new XSSFWorkbook();
     	wbT.createSheet();
	
         // 엑셀 파일 생성
         excelService.createXSSFWorkbook(wbT, sb.toString());
    	}
    	
        // 엑셀 파일 로드
        XSSFWorkbook wb = excelService.loadXSSFWorkbook(sb.toString());
        log.debug("testModifyCellContents after loadWorkbook....");
        
        XSSFSheet sheet = wb.getSheetAt(0);
        Font f2 = wb.createFont();
        CellStyle cs = wb.createCellStyle();
        cs = wb.createCellStyle();
        
        cs.setFont( f2 );
        //Word Wrap MUST be turned on
        cs.setWrapText( true );
        
        XSSFRow row = sheet.createRow( rownum );
        row.setHeight( (short) 0x349 );
        XSSFCell cellx = row.createCell( cellnum );
        cellx.setCellType( SXSSFCell.CELL_TYPE_STRING );
        cellx.setCellValue( new XSSFRichTextString(content) );
        cellx.setCellStyle( cs );
        
        sheet.setColumnWidth( 20, (int) ( ( 50 * 8 ) / ( (double) 1 / 20 ) ) );
        
        //excelService.writeWorkbook(wb);
        
        FileOutputStream outx = new FileOutputStream(sb.toString());
        wb.write(outx);
        outx.close();
        
        // 엑셀 파일 로드
        Workbook wb1 = excelService.loadXSSFWorkbook(sb.toString());
        
        Sheet sheet1 = wb1.getSheetAt(0);
        Row row1 = sheet1.getRow(rownum);
        Cell cell1 = row1.getCell( cellnum );
        
        // 수정된 셀의 내용 점검
        log.debug("cell ###" + cell1.getRichStringCellValue() + "###");
        log.debug("cont ###" + content + "###");
        
        assertNotSame("TEST", cell1.getRichStringCellValue().toString());
        assertEquals(content, cell1.getRichStringCellValue().toString());
        
    } catch (Exception e) {
    	log.error(e.toString());
    	throw new Exception(e);
    } finally {
    	log.debug("testModifyCellContents end....");
    }
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:74,代码来源:EgovExcelXSSFServiceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShowBrowserDialog类代码示例发布时间:2022-05-23
下一篇:
Java BaseFormAttribute类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap