本文整理汇总了Java中org.apache.poi.ss.usermodel.Cell.setCellValue方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.setCellValue方法的具体用法?Java Cell.setCellValue怎么用?Java Cell.setCellValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.ss.usermodel.Cell的用法示例。
在下文中一共展示了Cell.setCellValue方法的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setupTotalCell
点赞 5
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
protected void setupTotalCell(Cell cell, final String propId, final int currentRow, final int startRow, int col) {
cell.setCellStyle(getCellStyle(propId, currentRow, startRow, col, true));
final HorizontalAlignment poiAlignment = getGridHolder().getCellAlignment(propId);
CellUtil.setAlignment(cell, poiAlignment);
Class> propType = getGridHolder().getPropertyType(propId);
if (isNumeric(propType)) {
CellRangeAddress cra = new CellRangeAddress(startRow, currentRow - 1, col, col);
if (isHierarchical()) {
// 9 & 109 are for sum. 9 means include hidden cells, 109 means exclude.
// this will show the wrong value if the user expands an outlined category, so
// we will range value it first
cell.setCellFormula("SUM(" + cra.formatAsString(hierarchicalTotalsSheet.getSheetName(),
true) + ")");
} else {
cell.setCellFormula("SUM(" + cra.formatAsString() + ")");
}
} else {
if (0 == col) {
cell.setCellValue(createHelper.createRichTextString("Total"));
}
}
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:23,
示例2: setCellValue
点赞 3
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
private static void setCellValue(Cell cell, Object obj){
if(obj == null){
}else if(obj instanceof String){
cell.setCellValue((String) obj);
}else if(obj instanceof Date){
Date date = (Date) obj;
if(date != null){
cell.setCellValue(DateUtils.dfDateTime.format(date));
}
}else if(obj instanceof Calendar){
Calendar calendar = (Calendar) obj;
if(calendar != null){
cell.setCellValue(DateUtils.dfDateTime.format(calendar.getTime()));
}
}else if(obj instanceof Timestamp){
Timestamp timestamp = (Timestamp) obj;
if(timestamp != null){
cell.setCellValue(DateUtils.dfDateTime.format(new Date(timestamp.getTime())));
}
}else if(obj instanceof Double){
cell.setCellValue((Double) obj);
}else{
cell.setCellValue(obj.toString());
}
}
开发者ID:xujeff,项目名称:tianti,代码行数:26,
示例3: createFirstRow
点赞 3
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
private static List createFirstRow(String sheetName,
List locales, Sheet sheet, CellStyle styleTitle) {
int colIdx = 0;
Row titleRow = sheet.createRow(0);
sheet.setColumnWidth(colIdx, 30 * 256);
Cell titleCell = titleRow.createCell(colIdx++);
titleCell.setCellStyle(styleTitle);
titleCell.setCellValue(getDefaultResourceBundle().getString(
BaseBean.LABEL_SHOP_TRANSLARIONS_KEY));
return createColumnHeaders(sheetName, locales, sheet, styleTitle,
colIdx, titleRow);
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:13,
示例4: setCellValue
点赞 3
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
protected void setCellValue(Cell sheetCell, Object value, Class> valueType, Object propId) {
if (null != value) {
if (!isNumeric(valueType)) {
if (java.util.Date.class.isAssignableFrom(valueType)) {
sheetCell.setCellValue((Date) value);
} else {
sheetCell.setCellValue(createHelper.createRichTextString(value.toString()));
}
} else {
try {
// parse all numbers as double, the format will determine how they appear
final Double d = Double.parseDouble(value.toString());
sheetCell.setCellValue(d);
} catch (final NumberFormatException nfe) {
LOGGER.warning("NumberFormatException parsing a numeric value: " + nfe);
sheetCell.setCellValue(createHelper.createRichTextString(value.toString()));
}
}
}
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:21,
示例5: feedDetailsSheet
点赞 3
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
public void feedDetailsSheet(Sheet sheet, boolean exportAsTemplate, List xLTestSteps) {
int index = 0;
for (XLTestStep xLTestStep : xLTestSteps) {
index++;
Row row = sheet.createRow(index);
Cell cell = row.createCell(STEPNAME_INDEX);
cell.setCellValue(xLTestStep.getName());
cell = row.createCell(EXPECTED_OR_ACTION_INDEX);
cell.setCellValue(xLTestStep.getExpected());
cell = row.createCell(RESULT_INDEX);
if (exportAsTemplate)
cell.setCellValue("");
else
cell.setCellValue(xLTestStep.getActual());
cell = row.createCell(STATUS_INDEX);
formatCellStatus(sheet, cell);
if (exportAsTemplate)
cell.setCellValue("");
else
cell.setCellValue(Integer.parseInt(xLTestStep.getStatus()));
}
this.autoSize(sheet, new int[] { 0, 1, 2, 3 });
}
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,
示例6: CreateCell
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
public void CreateCell(Cell c, Row r, Sheet s, CellStyle cs, int colinaI, int colinaF, String valorS, int linhaI, int linhaF) {
c = r.createCell(linhaI);
c.setCellStyle(cs);
c.setCellValue(valorS);
s.addMergedRegion(new CellRangeAddress(colinaI, colinaF, linhaI, linhaF));
for (int e = (linhaI + 1); e <= linhaF; e++) {
c = r.createCell(e);
c.setCellStyle(cs);
}
}
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:12,
示例7: setCellValue
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* 给一个Cell赋值,若为空则视为"",若不为基本类型及其包装类(日期类型除外),则其值通过toString()获取
*
* @param cell 一个单元格
* @param value 值
* @return 若此单元格写入空数据则返回true, 否则返回false
*/
private boolean setCellValue(Cell cell, Object value) {
boolean isBlankCell = false;
if (value == null) {
cell.setCellValue("");
isBlankCell = true;
} else if (value instanceof String) {
cell.setCellValue((String) value);
} else if (value instanceof Integer) {
cell.setCellValue((Integer) value);
} else if (value instanceof Date) {
cell.setCellValue(this.dateFormat.format(value));
} else if (value instanceof Calendar) {
cell.setCellValue(this.dateFormat.format(value));
} else if (value instanceof Boolean) {
cell.setCellValue((Boolean) value);
} else if (value instanceof Float) {
cell.setCellValue((Float) value);
} else if (value instanceof Double) {
cell.setCellValue((Double) value);
} else if (value instanceof Byte) {
cell.setCellValue((Byte) value);
} else if (value instanceof Short) {
cell.setCellValue((Short) value);
} else {
cell.setCellValue(value.toString());
}
return isBlankCell;
}
开发者ID:FlyingHe,项目名称:UtilsMaven,代码行数:36,
示例8: createCellM
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
public static void createCellM(Cell c, Row r, Sheet s, CellStyle cs, int colinaI, int colinaF, String valorS, int linhaI, int linhaF) {
c = r.createCell(linhaI);
c.setCellStyle(cs);
c.setCellValue(valorS);
s.addMergedRegion(new CellRangeAddress(colinaI, colinaF, linhaI, linhaF));
for (int e = (linhaI + 1); e <= linhaF; e++) {
c = r.createCell(e);
c.setCellStyle(cs);
}
}
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:12,
示例9: addCell
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* 添加一个单元格
* @param row 添加的行
* @param column 添加列号
* @param val 添加值
* @param align 对齐方式(1:靠左;2:居中;3:靠右)
* @return 单元格对象
*/
public Cell addCell(Row row, int column, Object val, int align, Class> fieldType){
Cell cell = row.createCell(column);
CellStyle style = styles.get("data"+(align>=1&&align<=3?align:""));
try {
if (val == null){
cell.setCellValue("");
} else if (val instanceof String) {
cell.setCellValue((String) val);
} else if (val instanceof Integer) {
cell.setCellValue((Integer) val);
} else if (val instanceof Long) {
cell.setCellValue((Long) val);
} else if (val instanceof Double) {
cell.setCellValue((Double) val);
} else if (val instanceof Float) {
cell.setCellValue((Float) val);
} else if (val instanceof Date) {
DataFormat format = wb.createDataFormat();
style.setDataFormat(format.getFormat("yyyy-MM-dd"));
cell.setCellValue((Date) val);
} else {
if (fieldType != Class.class){
cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
}else{
cell.setCellValue((String)Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
"fieldtype."+val.getClass().getSimpleName()+"Type")).getMethod("setValue", Object.class).invoke(null, val));
}
}
} catch (Exception ex) {
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
cell.setCellValue(val.toString());
}
cell.setCellStyle(style);
return cell;
}
开发者ID:sombie007,项目名称:ExcelHandle,代码行数:44,
示例10: writeDailyVisits
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* Takes a two-dimensional array of visits. The first indices represent
* months and the second indices represent days. It writes visits to
* corresponding columns.
* @param dailyVisitCounts - a two dimensional array of visits of size [12][31]
*/
public void writeDailyVisits(int[][] dailyVisitCounts) {
for (int i = 1; i < 32; i++) {
Row row = dailyTimesSheet.createRow(i);
Cell cell = row.createCell(0);
cell.setCellValue(i);
for (int j=0; j < dailyVisitCounts.length; j++) {
cell = row.createCell(j+1);
cell.setCellValue(dailyVisitCounts[j][i-1]);
}
}
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-4-dorfner-v2,代码行数:18,
示例11: createHeader
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* Creates the header row for the sheet provided.
*
* @param sheet the sheet to create the header for
* @param langs the languages to use in the header
*/
private void createHeader(Sheet sheet,
Map langs)
{
LOG.info("Create header row with languages " + langs.toString());
CellStyle key = sheet.getWorkbook().createCellStyle();
key.setAlignment(CellStyle.ALIGN_CENTER);
key.setBorderBottom(CellStyle.BORDER_MEDIUM);
key.setBorderRight(CellStyle.BORDER_MEDIUM);
Font f = sheet.getWorkbook().createFont();
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
key.setFont(f);
CellStyle hlang = sheet.getWorkbook().createCellStyle();
hlang.setAlignment(CellStyle.ALIGN_CENTER);
hlang.setBorderBottom(CellStyle.BORDER_MEDIUM);
hlang.setBorderRight(CellStyle.BORDER_THIN);
hlang.setFont(f);
Row row = sheet.createRow(this.languageHeaderRow);
Cell cell = row.createCell(this.keyColumn);
cell.setCellStyle(key);
cell.setCellValue("KEY");
for (Entry lang : langs.entrySet())
{
cell = row.createCell(lang.getValue());
cell.setCellStyle(hlang);
cell.setCellValue(lang.getKey().toString());
}
}
开发者ID:namics,项目名称:spring-i18n-support,代码行数:36,
示例12: writeRating
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* Adds the given information as a new row to the sheet.
* @param id: plant ID number
* @param commonName: common name of flower
* @param cultivar: cultivar name of flower
* @param gardenLocation: bed number of flower
* @param likes: number of likes on the flower
* @param dislikes: number of dislikes on the flower
* @param visits: number of visits on the flower
* @param comments: number of comments on the flower
*/
public void writeRating(String id, String commonName, String cultivar, String gardenLocation, int likes, int dislikes, int visits, int comments){
Row row = ratingsSheet.createRow(ratingCount);
Cell cell = row.createCell(0);
cell.setCellValue(id);
cell = row.createCell(1);
cell.setCellValue(commonName);
cell = row.createCell(2);
cell.setCellValue(cultivar);
cell = row.createCell(3);
cell.setCellValue(gardenLocation);
cell = row.createCell(4);
cell.setCellValue(likes);
cell = row.createCell(5);
cell.setCellValue(dislikes);
cell = row.createCell(6);
cell.setCellValue(visits);
cell = row.createCell(7);
cell.setCellValue(comments);
ratingCount++;
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-4-dorfner-v2,代码行数:41,
示例13: createHeader
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
private int createHeader(Sheet sheet, int rowNum, String[] titles) {
Row headerRow = sheet.createRow(rowNum);
headerRow.setHeightInPoints(40);
Cell headerCell;
int[] cols = new int[titles.length];
for (int i = 0; i < titles.length; i++) {
cols[i] = i;
headerCell = headerRow.createCell(i);
headerCell.setCellValue(titles[i]);
headerCell.setCellStyle(styles.get("header"));
}
autoSize(sheet, cols);
return rowNum;
}
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,
示例14: createCell
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
public static void createCell(Cell c, Row r, Sheet s, CellStyle cs, int colinaI, int colinaF, String valorS, int linhaI, int linhaF) {
c = r.createCell(linhaI);
c.setCellStyle(cs);
c.setCellValue(valorS);
s.setColumnWidth(linhaI, linhaF*1000);
}
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:8,
示例15: writeComment
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* Adds the given information as a new row to the sheet.
* @param id: plant ID number
* @param comment: comment left by visitor
* @param timestamp: time the user left the comment
*/
public void writeComment(String id, String commonName, String cultivar, String gardenLocation, String comment, Date timestamp){
Row row = commentsSheet.createRow((short) commentCount);
Cell cell = row.createCell(0);
cell.setCellValue(id);
cell = row.createCell(1);
cell.setCellValue(commonName);
cell = row.createCell(2);
cell.setCellValue(cultivar);
cell = row.createCell(3);
cell.setCellValue(gardenLocation);
cell = row.createCell(4);
CellStyle style = workbook.createCellStyle();
style.setWrapText(true);
cell.setCellStyle(style);
cell.setCellValue(comment);
cell = row.createCell(5);
cell.setCellValue(timestamp.toString());
commentCount++;
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-4-dorfner-v2,代码行数:34,
示例16: writeComment
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* Adds the given information as a new row to the sheet.
* @param id: plant ID number
* @param comment: comment left by visitor
* @param timestamp: time the user left the comment
*/
public void writeComment(String id, String comment, Date timestamp){
Row row = sheet.createRow(rowCount);
Cell cell = row.createCell(0);
cell.setCellValue(id);
cell = row.createCell(1);
cell.setCellValue(comment);
cell = row.createCell(2);
cell.setCellValue(timestamp.toString());
rowCount++;
}
开发者ID:UMM-CSci-3601-S17,项目名称:digital-display-garden-iteration-3-sixguysburgers-fries,代码行数:21,
示例17: exportToExcelFile
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* 把矩阵导出到EXCEL文件
* @param workbook
* @param matrix
* @param file
* @param sheetName
* @throws IOException
*/
private static void exportToExcelFile(final Workbook workbook, final Matrix matrix,
final File file, String sheetName) throws IOException
{
final Sheet sheet = workbook.createSheet(sheetName);
final int rowCount = (int) matrix.getRowCount();
final int columnCount = (int) matrix.getColumnCount();
for(int r = 0; r < rowCount; r++)
{
Row row = sheet.createRow(r);
for(int c = 0; c < columnCount; c++)
{
Object obj = matrix.getAsObject(r, c);
if (obj != null)
{
Cell cell = row.createCell(c);
if (obj instanceof Double)
{
cell.setCellValue((Double) obj);
}
else if (obj instanceof String)
{
cell.setCellValue((String) obj);
}
else if (obj instanceof Date)
{
cell.setCellValue((Date) obj);
}
else if (obj instanceof Boolean)
{
cell.setCellValue((Boolean) obj);
}
else
{
cell.setCellValue(StringUtil.convert(obj));
}
}
}
}
final FileOutputStream fileOutputStream = new FileOutputStream(file);
final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
workbook.write(fileOutputStream);
bufferedOutputStream.close();
fileOutputStream.close();
}
开发者ID:ansleliu,项目名称:GraphicsViewJambi,代码行数:56,
示例18: setCellValue
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/** 给cell设置值
* @param cell
* @param returnVal
*/
private static void setCellValue(Cell cell, ExportFieldInfo fieldInfo, Object returnVal, Object current) {//以object来接收,会将基本数据类型自动装箱为包装类型
ExportProcessor processor = fieldInfo.getExportProcessor();
if(processor != null){
if(LinkProcessor.class.isAssignableFrom(processor.getClass())){
//处理链接类型
setHyperlink(cell, (LinkProcessor) processor, returnVal, current);
}
returnVal = processor.process(returnVal, current);
}else if(returnVal == null ){
return ;
}else if(fieldInfo.getDataType() != null && fieldInfo.getDataType() != DataType.None){
try {
switch (fieldInfo.getDataType()) {
case String:
returnVal = ConvertUtils.convertIfNeccesary(returnVal, String.class, fieldInfo.getDateFormat());
break;
case Number :
returnVal = ConvertUtils.convertIfNeccesary(returnVal, Double.class, null);
break;
case Boolean :
returnVal = ConvertUtils.convertIfNeccesary(returnVal, Boolean.class, null);
break;
case Date :
returnVal = ConvertUtils.convertIfNeccesary(returnVal, Date.class, null);
break;
default:
break;
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
if(String.class.equals(returnVal.getClass())){
cell.setCellValue((String)returnVal);
}else if(Boolean.class.equals(returnVal.getClass())){
cell.setCellValue((Boolean)returnVal);
}else if(Date.class.equals(returnVal.getClass())){
cell.setCellValue((Date)returnVal);
}else if (Number.class.isAssignableFrom(returnVal.getClass())){
cell.setCellValue(((Number)returnVal).doubleValue());
}else if(Character.class == returnVal.getClass()){
cell.setCellValue(returnVal.toString());;
}
}
开发者ID:long47964,项目名称:excel-utils,代码行数:51,
示例19: createWorkbook
点赞 2
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
@Override
public Workbook createWorkbook(List indicacoes) {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("Indicações");
int rownum = 0;
int colnum = 0;
Cell cell;
Row row;
row = sheet.createRow(rownum++);
cell = row.createCell(colnum++);
cell.setCellValue("Diário");
cell = row.createCell(colnum++);
cell.setCellValue("Número");
cell = row.createCell(colnum++);
cell.setCellValue("Ano");
cell = row.createCell(colnum++);
cell.setCellValue("Data");
cell = row.createCell(colnum++);
cell.setCellValue("Vereador");
cell = row.createCell(colnum++);
cell.setCellValue("Descrição");
cell = row.createCell(colnum++);
cell.setCellValue("Rua");
cell = row.createCell(colnum++);
cell.setCellValue("Obs");
cell = row.createCell(colnum++);
cell.setCellValue("Bairro");
for (Indicacao ind : indicacoes) {
row = sheet.createRow(rownum++);
// FIXME Stop ignoring diary number and extract, maybe from metadata
colnum = 1; // Ignoring diary number
cell = row.createCell(colnum++);
cell.setCellValue(ind.getNumber());
cell = row.createCell(colnum++);
cell.setCellValue(ind.getYear());
colnum++; // Ignoring date column
cell = row.createCell(colnum++);
String vereadores = ind.vereadoresToString();
cell.setCellValue(vereadores);
cell = row.createCell(colnum++);
cell.setCellValue(ind.getDescricao());
cell = row.createCell(colnum++);
cell.setCellValue(ind.ruasToString());
// FIXME Think a way to extract obs
colnum++; // Ignoring "obs" column
cell = row.createCell(colnum++);
cell.setCellValue(ind.getBairro());
}
for (int i = 0; i < colnum; i++)
sheet.autoSizeColumn(i);
return workbook;
}
开发者ID:eduardohmg,项目名称:diario-extractor,代码行数:75,
示例20: computeIDCG_nDCG
点赞 1
import org.apache.poi.ss.usermodel.Cell; //导入方法依赖的package包/类
/**
* generates the IDCG and nDCG
* @param prec_recall
* @param rowPR
* @param ratings
*/
private static void computeIDCG_nDCG(Sheet prec_recall, Row rowPR, ArrayList ratings) {
CellReference cellRefDCGFirst = new CellReference(1, COLUMN_DCG);
CellReference cellRefDCGLast = new CellReference(50, COLUMN_DCG);
Cell cellPR = rowPR.createCell(COLUMN_DCG);
cellPR.setCellFormula("SUM("+cellRefDCGFirst.formatAsString()
+":"+cellRefDCGLast.formatAsString()+")");
//Get the List of ratings and sort them by relevance (rating)
Collections.sort(ratings, new Comparator() {
@Override
public int compare(Rating o1, Rating o2) {
return Float.compare(o2.rating, o1.rating);
}
});
//go through the sheet again and add the ideal rank
int current_position = 1;
for (Iterator it = ratings.iterator(); it.hasNext();) {
int rank = it.next().getCompetenceRank();
Row rowPR2 = prec_recall.getRow(rank);
//CellReference cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex());
cellPR = rowPR2.createCell(COLUMN_IDEAL_RANK, Cell.CELL_TYPE_NUMERIC);
cellPR.setCellValue(current_position);
CellReference cellRefNovice = new CellReference(rowPR2.getRowNum(), COLUMN_NOVICE);
CellReference cellRefIrrelevant = new CellReference(rowPR2.getRowNum(), COLUMN_IRRELEVANT);
CellReference cellRefNoviceWeight = new CellReference(0, COLUMN_NOVICE);
CellReference cellRefIrrelevantWeight = new CellReference(0, COLUMN_IRRELEVANT);
CellReference cellRefIdealRank = new CellReference(rowPR2.getRowNum(), COLUMN_IDEAL_RANK);
cellPR = rowPR2.createCell(COLUMN_IDCG, Cell.CELL_TYPE_NUMERIC);
//LOG 1 is not defined
if(current_position==1)
cellPR.setCellFormula("SUMIF("+cellRefNovice.formatAsString()+":"+cellRefIrrelevant.formatAsString()+",1,"+cellRefNoviceWeight.formatAsString()+":"+cellRefIrrelevantWeight.formatAsString()+")");
else
cellPR.setCellFormula("SUMIF("+cellRefNovice.formatAsString()+":"+cellRefIrrelevant.formatAsString()+",1,"+cellRefNoviceWeight.formatAsString()+":"+cellRefIrrelevantWeight.formatAsString()+")/LOG("+cellRefIdealRank.formatAsString()+",2)");
current_position++;
}
//sum of iDCG
cellPR = rowPR.createCell(COLUMN_IDCG, Cell.CELL_TYPE_NUMERIC);
CellReference cellRefIDCGFirst = new CellReference(1, COLUMN_IDCG);
CellReference cellRefIDCGLast = new CellReference(50, COLUMN_IDCG);
cellPR.setCellFormula("SUM("+cellRefIDCGFirst.formatAsString()+":"+cellRefIDCGLast.formatAsString()+")");
//nDCG
CellReference cellRefDCG = new CellReference(rowPR.getRowNum(), COLUMN_DCG);
CellReference cellRefIDCG = new CellReference(rowPR.getRowNum(), COLUMN_IDCG);
cellPR = rowPR.createCell(COLUMN_nDCG, Cell.CELL_TYPE_NUMERIC);
cellPR.setCellFormula("SUM("+cellRefDCG.formatAsString()+"/"+cellRefIDCG.formatAsString()+")");
}
开发者ID:SemanticSoftwareLab,项目名称:ScholarLens,代码行数:77,
注:本文中的org.apache.poi.ss.usermodel.Cell.setCellValue方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。