gpt4 book ai didi

org.apache.poi.xslf.usermodel.XSLFTableRow类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 02:43:05 35 4
gpt4 key购买 nike

本文整理了Java中org.apache.poi.xslf.usermodel.XSLFTableRow类的一些代码示例,展示了XSLFTableRow类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFTableRow类的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFTableRow
类名称:XSLFTableRow

XSLFTableRow介绍

[英]Represents a table in a .pptx presentation
[中]表示中的表。pptx演示文稿

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public XSLFTableCell getCell(int row, int col) {
  List<XSLFTableRow> rows = getRows();
  if (row < 0 || rows.size() <= row) {
    return null;
  }
  XSLFTableRow r = rows.get(row);
  if (r == null) {
    // empty row
    return null;
  }
  List<XSLFTableCell> cells = r.getCells();
  if (col < 0 || cells.size() <= col) {
    return null;
  }
  // cell can be potentially empty ...
  return cells.get(col);
}

代码示例来源:origin: org.apache.poi/poi-ooxml

public XSLFTableRow addRow(){
  CTTableRow tr = _table.addNewTr();
  XSLFTableRow row = new XSLFTableRow(tr, this);
  // default height is 20 points
  row.setHeight(20.0);    
  _rows.add(row);
  updateRowColIndexes();
  return row;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public XSLFTable createTable(int numRows, int numCols){
  if (numRows < 1 || numCols < 1) {
    throw new IllegalArgumentException("numRows and numCols must be greater than 0");
  }
  XSLFTable sh = getDrawing().createTable();
  _shapes.add(sh);
  sh.setParent(this);
  for (int r=0; r<numRows; r++) {
    XSLFTableRow row = sh.addRow();
    for (int c=0; c<numCols; c++) {
      row.addCell();
    }
  }
  return sh;
}

代码示例来源:origin: stackoverflow.com

XSLFTableRow titleRow = tbl.addRow();
titleRow.setHeight(50);
XSLFTableCell titleCell1 = titleRow.addCell();
XSLFTextParagraph p1 = titleCell1.addNewTextParagraph();
p1.setTextAlign(TextAlign.CENTER);
XSLFTextRun r1 = p1.addNewTextRun();
r1.setText("Column title");
r1.setBold(true);
r1.setFontColor(new Color(0, 104, 145));
titleCell1.setFillColor(new Color(190, 230, 245));
r1.setFontSize(25.0);
titleCell1.setVerticalAlignment(VerticalAlignment.MIDDLE);

代码示例来源:origin: org.apache.poi/poi-ooxml

/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){
  super(shape, sheet);
  CTGraphicalObjectData god = shape.getGraphic().getGraphicData();
  XmlCursor xc = god.newCursor();
  try {
    if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) {
      throw new IllegalStateException("a:tbl element was not found in\n " + god);
    }

    XmlObject xo = xc.getObject();
    // Pesky XmlBeans bug - see Bugzilla #49934
    // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
    if (xo instanceof XmlAnyTypeImpl){
      String errStr =
        "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " +
        "loading is used and the thread context classloader has no reference to " +
        "the xmlbeans classes"
      ;
      throw new IllegalStateException(errStr);
    }
    _table = (CTTable)xo;
  } finally {
    xc.dispose();
  }
  _rows = new ArrayList<>(_table.sizeOfTrArray());
  for(CTTableRow row : _table.getTrList()) {
    _rows.add(new XSLFTableRow(row, this));
  }
  updateRowColIndexes();
}

代码示例来源:origin: org.apache.poi/poi-examples

int numRows = 5;
XSLFTableRow headerRow = tbl.addRow();
headerRow.setHeight(50);
  XSLFTableCell th = headerRow.addCell();
  XSLFTextParagraph p = th.addNewTextParagraph();
  p.setTextAlign(TextAlign.CENTER);
  tr.setHeight(50);
    XSLFTableCell cell = tr.addCell();
    XSLFTextParagraph p = cell.addNewTextParagraph();
    XSLFTextRun r = p.addNewTextRun();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){
  super(shape, sheet);
  CTGraphicalObjectData god = shape.getGraphic().getGraphicData();
  XmlCursor xc = god.newCursor();
  try {
    if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) {
      throw new IllegalStateException("a:tbl element was not found in\n " + god);
    }

    XmlObject xo = xc.getObject();
    // Pesky XmlBeans bug - see Bugzilla #49934
    // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
    if (xo instanceof XmlAnyTypeImpl){
      String errStr =
        "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " +
        "loading is used and the thread context classloader has no reference to " +
        "the xmlbeans classes"
      ;
      throw new IllegalStateException(errStr);
    }
    _table = (CTTable)xo;
  } finally {
    xc.dispose();
  }
  _rows = new ArrayList<>(_table.sizeOfTrArray());
  for(CTTableRow row : _table.getTrList()) {
    _rows.add(new XSLFTableRow(row, this));
  }
  updateRowColIndexes();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

XSLFTableCell cell = row.getCells().get(colPos);

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public XSLFTableRow addRow(){
  CTTableRow tr = _table.addNewTr();
  XSLFTableRow row = new XSLFTableRow(tr, this);
  row.setHeight(20.0);    // default height is 20 points
  _rows.add(row);
  return row;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

@Override
public XSLFTable createTable(int numRows, int numCols){
  if (numRows < 1 || numCols < 1) {
    throw new IllegalArgumentException("numRows and numCols must be greater than 0");
  }
  XSLFTable sh = getDrawing().createTable();
  getShapes().add(sh);
  sh.setParent(this);
  for (int r=0; r<numRows; r++) {
    XSLFTableRow row = sh.addRow();
    for (int c=0; c<numCols; c++) {
      row.addCell();
    }
  }
  return sh;
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){
  super(shape, sheet);
  XmlObject[] rs = shape.getGraphic().getGraphicData()
      .selectPath("declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' ./a:tbl");
  if (rs.length == 0) {
    throw new IllegalStateException("a:tbl element was not found in\n " + shape.getGraphic().getGraphicData());
  }
  // Pesky XmlBeans bug - see Bugzilla #49934
  // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
  if(rs[0] instanceof XmlAnyTypeImpl){
    try {
      rs[0] = CTTable.Factory.parse(rs[0].toString());
    }catch (XmlException e){
      throw new POIXMLException(e);
    }
  }
  _table = (CTTable) rs[0];
  _rows = new ArrayList<XSLFTableRow>(_table.sizeOfTrArray());
  for(CTTableRow row : _table.getTrList()) _rows.add(new XSLFTableRow(row, this));
}

代码示例来源:origin: apache/tika

private void extractTable(XSLFTable tbl, XHTMLContentHandler xhtml) throws SAXException {
  xhtml.startElement("table");
  for (XSLFTableRow row : tbl) {
    xhtml.startElement("tr");
    for (XSLFTableCell c : row.getCells()) {
      xhtml.startElement("td");
      //TODO: Need to wait for fix in POI to test for hyperlink first
      //shouldn't need to catch NPE...
      XSLFHyperlink hyperlink = null;
      try {
        hyperlink = c.getHyperlink();
      } catch (NullPointerException e) {
        //swallow
      }
      if (hyperlink != null && hyperlink.getAddress() != null) {
        xhtml.startElement("a", "href", hyperlink.getAddress());
      }
      xhtml.characters(c.getText());
      if (hyperlink != null && hyperlink.getAddress() != null) {
        xhtml.endElement("a");
      }
      xhtml.endElement("td");
    }
    xhtml.endElement("tr");
  }
  xhtml.endElement("table");
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public XSLFTableRow addRow(){
  CTTableRow tr = _table.addNewTr();
  XSLFTableRow row = new XSLFTableRow(tr, this);
  // default height is 20 points
  row.setHeight(20.0);    
  _rows.add(row);
  updateRowColIndexes();
  return row;
}

代码示例来源:origin: stackoverflow.com

XSLFTableRow headerRow = table.addRow();
 for(int i = 0; i < 3; i++) {
   XSLFTableCell th = headerRow.addCell();
   XSLFTextParagraph p = th.addNewTextParagraph();
   XSLFTextRun r = p.addNewTextRun();
   r.setText("Text");
 }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public XSLFTableCell getCell(int row, int col) {
  List<XSLFTableRow> rows = getRows();
  if (row < 0 || rows.size() <= row) {
    return null;
  }
  XSLFTableRow r = rows.get(row);
  if (r == null) {
    // empty row
    return null;
  }
  List<XSLFTableCell> cells = r.getCells();
  if (col < 0 || cells.size() <= col) {
    return null;
  }
  // cell can be potentially empty ...
  return cells.get(col);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public XSLFTable createTable(int numRows, int numCols){
  if (numRows < 1 || numCols < 1) {
    throw new IllegalArgumentException("numRows and numCols must be greater than 0");
  }
  XSLFTable sh = getDrawing().createTable();
  _shapes.add(sh);
  sh.setParent(this);
  for (int r=0; r<numRows; r++) {
    XSLFTableRow row = sh.addRow();
    for (int c=0; c<numCols; c++) {
      row.addCell();
    }
  }
  return sh;
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

XSLFTableCell cell = row.getCells().get(colPos);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public XSLFTable createTable(int numRows, int numCols){
  if (numRows < 1 || numCols < 1) {
    throw new IllegalArgumentException("numRows and numCols must be greater than 0");
  }
  XSLFTable sh = getDrawing().createTable();
  getShapes().add(sh);
  sh.setParent(this);
  for (int r=0; r<numRows; r++) {
    XSLFTableRow row = sh.addRow();
    for (int c=0; c<numCols; c++) {
      row.addCell();
    }
  }
  return sh;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

XSLFTableCell cell = row.getCells().get(colPos);

代码示例来源:origin: stackoverflow.com

row.addCell().setText("Cell 1");
XSLFTableCell cell = row.addCell();
cell.setText("Cell 2");

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com