本文整理汇总了Java中org.odftoolkit.simple.table.Cell.setStringValue方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.setStringValue方法的具体用法?Java Cell.setStringValue怎么用?Java Cell.setStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.odftoolkit.simple.table.Cell
的用法示例。
在下文中一共展示了Cell.setStringValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBasicCell
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
public static Cell createBasicCell(final Table table, int colIndex, int rowIndex, Object value) {
final Cell cell = table.getCellByPosition(colIndex, rowIndex);
String strValue;
if (value == null) {
strValue = "";
} else if (value instanceof String) {
strValue = (String) value;
} else if (value instanceof Double) {
Double d = (Double) value;
strValue = LogFrameExportData.AGGR_AVG_FORMATTER.format(d.doubleValue());
} else if (value instanceof Long) {
Long l = (Long) value;
strValue = LogFrameExportData.AGGR_SUM_FORMATTER.format(l.longValue());
} else { // date
strValue = ExportConstants.EXPORT_DATE_FORMAT.format((Date) value);
}
cell.setStringValue(strValue);
cell.setCellStyleName(coreStyleName);
return cell;
}
示例2: addAdmonition
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
private void addAdmonition(AsciiElement element) {
this.setTitle(element, FontStyle.ITALIC, HorizontalAlignmentType.LEFT, 12, new Color("#7a2518"), odtDocument);
Table table = odtDocument.addTable(1, 2);
Cell rowOColumn0 = table.getCellByPosition(0, 0);
String caption = getSpecificProperty(element.getjObj(), "caption", String.class);
rowOColumn0.setDisplayText(caption.toUpperCase());
rowOColumn0.setHorizontalAlignment(HorizontalAlignmentType.CENTER);
rowOColumn0.setVerticalAlignment(VerticalAlignmentType.MIDDLE);
Cell rowOColumn1 = table.getCellByPosition(1, 0);
if (element.getNOfBlocks() == 0)
rowOColumn1.setStringValue(element.getContent());
else {
this.buildODTDocument(element.getChildren(), rowOColumn1);
}
Column column = table.getColumnByIndex(0);
column.setUseOptimalWidth(true);
column.setWidth(32.0);
}
示例3: putHeader
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
public static Cell putHeader(final Row row, int cellIndex, String header) {
Cell cell = row.getCellByIndex(cellIndex);
cell.setStringValue(header);
cell.setBorders(CellBordersType.ALL_FOUR, getBlackBorder());
cell.setCellBackgroundColor(ExportConstants.CALC_COL_GRAY10);
cell.setFont(getBoldFont(10));
cell.setVerticalAlignment(ExportConstants.ALIGN_VER_MIDDLE);
cell.setHorizontalAlignment(ExportConstants.ALIGH_HOR_CENTER);
cell.setTextWrapped(true);
return cell;
}
示例4: putGlobalExportHeader
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
public static Cell putGlobalExportHeader(final Row row, int cellIndex, String header) {
Cell cell = row.getCellByIndex(cellIndex);
cell.setStringValue(header);
cell.setCellStyleName(coreStyleName);
cell.setCellBackgroundColor(ExportConstants.CALC_COL_GRAY5);
cell.setFont(getFont(10, false, true));
return cell;
}
示例5: putMainTitle
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
public static void putMainTitle(final Table table, int rowIndex, int maxCols, String title) {
Row row = table.getRowByIndex(rowIndex);
Cell cell = row.getCellByIndex(1);
cell.setStringValue(title);
cell.setTextWrapped(true);
cell.setFont(CalcUtils.getBoldFont(14));
cell.setVerticalAlignment(ExportConstants.ALIGN_VER_MIDDLE);
cell.setHorizontalAlignment(ExportConstants.ALIGH_HOR_CENTER);
CellRange cellRange = table.getCellRangeByPosition(1, rowIndex, maxCols, rowIndex);
cellRange.merge();
row.setHeight(7, false);
}
示例6: editCell
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
private void editCell(AsciiElement element, Table table, String selection, int rowTableIndex, int rowElement, int column) {
JSObject documentCell = element.getCell(selection, rowElement, column);
Map<String, String> attrs = this.getCellAttributes(documentCell);
String cellText = this.getSpecificProperty(documentCell, "text", String.class);
Cell tableCell = this.getCell(table, rowTableIndex, column, attrs);
this.setAlignmentTypes(attrs, tableCell);
this.setSpecificFontStyle(selection, tableCell, attrs);
this.setBorderRight(tableCell);
tableCell.setStringValue($(cellText));
}
示例7: newLine
import org.odftoolkit.simple.table.Cell; //导入方法依赖的package包/类
@Override
public void newLine() throws IOException {
if (this.first) {
this.table.appendColumns(this.headers.size());
final Row row = this.table.getRowByIndex(0);
int i = 0;
for (String h : this.headers) {
final Cell c = row.getCellByIndex(i++);
c.setCellBackgroundColor(Color.ORANGE);
Font f = c.getFont();
f.setFontStyle(FontStyle.ITALIC);
f.setSize(10);
c.setFont(f);
c.setStringValue(h);
}
for (Node n : new DomNodeList(
this.table.getOdfElement().getChildNodes())) {
if (n instanceof TableTableRowElement) {
this.rowElement = (TableTableRowElement) n;
}
}
this.first = false;
}
final TableTableRowElement aRow =
(TableTableRowElement) OdfXMLFactory.newOdfElement(this.dom,
OdfName.newName(OdfDocumentNamespace.TABLE, "table-row"));
this.tableElement.appendChild(aRow);
this.rowElement = aRow;
}