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

Java Cell类代码示例

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

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



Cell类属于org.odftoolkit.simple.table包,在下文中一共展示了Cell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:22,代码来源:CalcUtils.java


示例2: getCellValue

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private Object getCellValue(Cell varCell) {
	Object cellValue = null;
	if ("boolean".equals(varCell.getValueType())) {
		// Boolean
		cellValue = varCell.getBooleanValue();
	} else if ("time".equals(varCell.getValueType())) {
		// Date
		cellValue = varCell.getTimeValue().getTime();
	} else if ("date".equals(varCell.getValueType())) {
		// Date
		cellValue = varCell.getDateValue().getTime();
	} else if ("float".equals(varCell.getValueType())) {
		// Double
		cellValue = varCell.getDoubleValue();
	} else if ("percentage".equals(varCell.getValueType())) {
		// Double
		cellValue = varCell.getPercentageValue();
	} else if ("currency".equals(varCell.getValueType())) {
		// String
		cellValue = varCell.getCurrencyCode();
	} else {
		// String
		cellValue = varCell.getStringValue();
	}
	return cellValue;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:27,代码来源:OdsImporter.java


示例3: addBlock

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private void addBlock(AsciiElement element) {
    final Table table = odtDocument.addTable(1, 1);
    Cell cell = table.getCellByPosition(0, 0);
    if (element.getName().equals("sidebar"))
        cell.setCellBackgroundColor(new Color("#f8f8f7"));

    HorizontalAlignmentType type;
    Border border = new Border(new Color("#e0e0dc"), 1.0, SupportedLinearMeasure.PT);
    if (element.getName().equals("open")) {
        type = HorizontalAlignmentType.JUSTIFY;
        border.setColor(Color.WHITE);
        cell.setBorders(CellBordersType.NONE, border);
    } else {
        type = HorizontalAlignmentType.CENTER;
        cell.setBorders(CellBordersType.ALL_FOUR, border);
    }

    this.setTitle(element, type, 14, new Color("#7a2518"), cell);
    this.buildODTDocument(element.getChildren(), cell);
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:21,代码来源:ODFConverter.java


示例4: 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);
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:22,代码来源:ODFConverter.java


示例5: addDList

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private void addDList(AsciiElement element, Component component) {
    final ParagraphContainer paragraphContainer;
    final ListContainer listContainer;
    if (component instanceof Cell) {
        Cell cell = (Cell) component;
        paragraphContainer = cell;
        listContainer = cell;
    } else {
        paragraphContainer = odtDocument;
        listContainer = odtDocument;
    }

    int dListBlockLength = element.getItemsLength();
    if (dListBlockLength > 0) {
        for (int index = 0; index < dListBlockLength; index++) {
            // traverse each item combining (dd + dt)
            JSObject items = element.getItemByIndex(index);
            this.addDListItems(items, paragraphContainer, listContainer);
        }
    }
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:22,代码来源:ODFConverter.java


示例6: setSpanAttributeOfCell

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private Cell setSpanAttributeOfCell(Table table, Map<String, String> attrs, Cell tableCell, OdfElement container) {
    int colSpan = Integer.valueOf(attrs.get("colspan"));
    int rowspan = Integer.valueOf(attrs.get("rowspan"));
    int row = tableCell.getRowIndex();
    int column = tableCell.getColumnIndex();
    int tableColumn = table.getColumnCount();
    int tableRow = table.getRowCount();

    boolean hasOfficeValueType = container.hasAttribute("office:value-type");
    if (!hasOfficeValueType) {
        if (colSpan != 1 || rowspan != 1) {
            colSpan = this.getNewSpanValue(colSpan, column, tableColumn);
            rowspan = this.getNewSpanValue(rowspan, row, tableRow);
            // spanned attribute in action
            CellRange cellRange = table.getCellRangeByPosition(column, row, colSpan, rowspan);
            cellRange.merge();
        }
    } else {
        int nextColumn = column + 1;
        if (nextColumn != tableColumn)
            tableCell = this.getCell(table, row, nextColumn, attrs);
    }
    return tableCell;
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:25,代码来源:ODFConverter.java


示例7: setSpecificFontStyle

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private void setSpecificFontStyle(String selection, Cell tableCell, Map<String, String> attrs) {
    Font font = createFont(12, Color.BLACK);
    if (selection.equals("head")) {
        font.setFontStyle(FontStyle.BOLDITALIC);
    } else if (selection.equals("foot")) {
        font.setFontStyle(FontStyle.ITALIC);
    } else {
        if (attrs.containsKey("style")) {
            String style = attrs.get("style");
            if (style.equals("strong"))
                font.setFontStyle(FontStyle.BOLD);
            else if (style.equals("emphasis"))
                font.setFontStyle(FontStyle.ITALIC);
            else if (style.equals("header"))
                font.setFontStyle(FontStyle.BOLDITALIC);
        }
    }
    tableCell.setFont(font);
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:20,代码来源:ODFConverter.java


示例8: getCategoryOrder

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private static List<String> getCategoryOrder(Table table, TableCoordinate headers, ContentDirection fdir) {
    List<String> categoryOrder = new ArrayList<String>();
    CellRange categoryRange = null;
    if (fdir == ContentDirection.VERTICAL) {
        categoryRange =
                table.getCellRangeByPosition(headers.getColumn(), headers.getRow(), table.getColumnCount() - 1,
                        headers.getRow());
    } else {
        categoryRange =
                table.getCellRangeByPosition(headers.getColumn(), headers.getRow(), headers.getColumn(),
                        table.getRowCount() - 1);
    }
    for (int i = 0; i < categoryRange.getColumnNumber(); i++) {
        for (int j = 0; j < categoryRange.getRowNumber(); j++) {
            Cell cell = categoryRange.getCellByPosition(i, j);
            Paragraph categoryParagraph = cell.getParagraphByIndex(0, false);
            String category = null;
            if (categoryParagraph == null || (category = categoryParagraph.getTextContent().trim()).isEmpty()) {
                logger.warn("Data category missing at (" + i + "," + j + ") in table '" + table.getTableName() + "'.");
                categoryOrder.add(null);
            } else {
                cell.removeParagraph(categoryParagraph);
                categoryOrder.add(category);
            };
        }
    }
    return categoryOrder;
}
 
开发者ID:FenixEdu,项目名称:oddjet,代码行数:29,代码来源:Template.java


示例9: 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;
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:13,代码来源:CalcUtils.java


示例10: 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;
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:10,代码来源:CalcUtils.java


示例11: 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);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:13,代码来源:CalcUtils.java


示例12: getText

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
public static String getText(SpreadsheetDocument spreadsheetDocument) {
    try {
        StringBuilder stringBuilder = new StringBuilder("");
        int sheetCount = spreadsheetDocument.getSheetCount();
        for(int i=0; i<sheetCount; i++) {
            Table sheet = spreadsheetDocument.getSheetByIndex(i);
            int rowCount = sheet.getRowCount();
            for(int y=0; y<rowCount; y++) {
                Row row = sheet.getRowByIndex(y);
                int cellCount = row.getCellCount();
                for(int x=0; x<cellCount; x++) {
                    Cell cell = row.getCellByIndex(x);
                    String value = cell.getStringValue();
                    stringBuilder.append(value);
                    stringBuilder.append("\t");
                }
                stringBuilder.append("\n");
            }
            stringBuilder.append("\n\n");
        }
        return stringBuilder.toString();
    }
    catch(Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:28,代码来源:OpenOfficeBox.java


示例13: addList

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private void addList(AsciiElement element, Component component) {
    final ListContainer listContainer;
    final ParagraphContainer paragraphContainer;
    if (component instanceof Cell) {
        Cell cell = (Cell) component;
        listContainer = cell;
        paragraphContainer = cell;
    } else {
        listContainer = odtDocument;
        paragraphContainer = odtDocument;
    }

    this.setTitle(element, FontStyle.ITALIC, HorizontalAlignmentType.LEFT, 12, new Color("#7a2518"), paragraphContainer);
    this.addListItems(element, listContainer);
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:16,代码来源:ODFConverter.java


示例14: 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));
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:13,代码来源:ODFConverter.java


示例15: getCell

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private Cell getCell(Table table, int rowTableIndex, int column, Map<String, String> attrs) {
    Cell tableCell = table.getCellByPosition(column, rowTableIndex);
    OdfElement container = tableCell.getFrameContainerElement();
    String localName = container.getOdfName().getLocalName();

    if (localName.equals("table-cell")) {
        tableCell = this.setSpanAttributeOfCell(table, attrs, tableCell, container);
    } else if (localName.equals("covered-table-cell")) {
        tableCell = this.getCell(table, rowTableIndex, column + 1, attrs);
    }

    return tableCell;
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:14,代码来源:ODFConverter.java


示例16: 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;

}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:37,代码来源:ODSTranslatorOutputFormat.java


示例17: parseTableRow

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private static String parseTableRow(Row row) {
    String line = "|";
    for (int i = 0; i < row.getCellCount(); i++) {
        Cell cell = row.getCellByIndex(i);
        line += cell.getDisplayText() + "|";
    }
    return line;
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:9,代码来源:OdfUtils.java


示例18: putGroupCell

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
public static void putGroupCell(final Table table, int colIndex, int rowIndex, String value) {
	final Cell cell = createBasicCell(table, colIndex, rowIndex, value);
	cell.setCellBackgroundColor(ExportConstants.CALC_COL_ORANGE);
	cell.setFont(getFont(10, false, true));
	cell.setHorizontalAlignment(ExportConstants.ALIGH_HOR_LEFT);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:7,代码来源:CalcUtils.java


示例19: applyLink

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
public static void applyLink(final Cell cell, String linkName, String target) throws Throwable {
	java.net.URI uri = new java.net.URI(URIUtil.encodeQuery("#" + normalizeAsLink(target)));
	cell.addParagraph(linkName).applyHyperlink(uri);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:5,代码来源:CalcUtils.java


示例20: createBasicCell

import org.odftoolkit.simple.table.Cell; //导入依赖的package包/类
private Cell createBasicCell(int colIndex, int rowIndex, String value) {
	cell = table.getCellByPosition(colIndex, rowIndex);
	cell.setStringValue(value);
	cell.setCellStyleName(coreCellStyle);
	return cell;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:7,代码来源:LogFrameCalcTemplate.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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