Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xwpf.usermodel
Class XWPFTable

    java.lang.Object
      org.apache.poi.xwpf.usermodel.XWPFTable

All Implemented Interfaces:
  IBodyElement

    public class XWPFTable

extends java.lang.Object
implements IBodyElement

Sketch of XWPFTable class. Only table's text is being hold.

Specifies the contents of a table present in the document. A table is a set of paragraphs (and other block-level content) arranged in rows and columns.

Author:
  Yury Batrakov (batrakov at gmail.com)

Field Summary
`protected IBody` | `part`
`protected java.util.List<java.lang.String>` | `styleIDs`
`protected java.util.List<XWPFTableRow>` | `tableRows`
`protected java.lang.StringBuffer` | `text`

Constructor Summary
`XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table, IBody part)`
`XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table, IBody part, int row, int col)`

Method Summary
`void` | `addNewCol()` add a new column for each row in this table
`void` | `addNewRowBetween(int start, int end)`
`void` | `addRow(XWPFTableRow row)` add a new Row to the table
`boolean` | `addRow(XWPFTableRow row, int pos)` add a new Row to the table at position pos
`XWPFTableRow` | `createRow()` create a new XWPFTableRow object with as many cells as the number of columns defined in that moment
`org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl` | `getCTTbl()`
`BodyElementType` | `getElementType()` returns the type of the BodyElement Table
`int` | `getNumberOfRows()`
`IBody` | `getPart()` returns the part of the bodyElement
`BodyType` | `getPartType()` returns the partType of the bodyPart which owns the bodyElement
`XWPFTableRow` | `getRow(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow row)` returns the XWPFRow which belongs to the CTRow row if this row is not existing in the table null will be returned
`XWPFTableRow` | `getRow(int pos)`
`java.util.List<XWPFTableRow>` | `getRows()`
`java.lang.String` | `getStyleID()` get the StyleID of the table
`java.lang.String` | `getText()`
`int` | `getWidth()`
`XWPFTableRow` | `insertNewTableRow(int pos)` inserts a new tablerow
`boolean` | `removeRow(int pos)` Remove a row at position pos from the table
`void` | `setWidth(int width)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### text

    protected java.lang.StringBuffer text

### tableRows

    protected java.util.List<XWPFTableRow> tableRows

### styleIDs

    protected java.util.List<java.lang.String> styleIDs

### part

    protected IBody part

Constructor Detail

### XWPFTable

    public XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table,
                     IBody part,
                     int row,
                     int col)

### XWPFTable

    public XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table,
                     IBody part)

Method Detail

### getCTTbl

    @Internal
    public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl getCTTbl()

  Returns:
    ctTbl object

### getText

    public java.lang.String getText()

  Returns:
    text

### addNewRowBetween

    public void addNewRowBetween(int start,
                                 int end)

### addNewCol

    public void addNewCol()

  add a new column for each row in this table

### createRow

    public XWPFTableRow createRow()

  create a new XWPFTableRow object with as many cells as the number of columns defined in that moment

  Returns:
    tableRow

### getRow

    public XWPFTableRow getRow(int pos)

  Parameters:
    `pos` - - index of the row
  Returns:
    the row at the position specified or null if no rows is defined or if the position is greather than the max size of rows array

### setWidth

    public void setWidth(int width)

  Parameters:
    `width` -

### getWidth

    public int getWidth()

  Returns:
    width value

### getNumberOfRows

    public int getNumberOfRows()

  Returns:
    number of rows in table

### getStyleID

    public java.lang.String getStyleID()

  get the StyleID of the table

  Returns:
    style-ID of the table

### addRow

    public void addRow(XWPFTableRow row)

  add a new Row to the table

  Parameters:
    `row` - the row which should be added

### addRow

    public boolean addRow(XWPFTableRow row,
                          int pos)

  add a new Row to the table at position pos

  Parameters:
    `row` - the row which should be added

### insertNewTableRow

    public XWPFTableRow insertNewTableRow(int pos)

  inserts a new tablerow

  Parameters:
    `pos` -
  Returns:
    the inserted row

### removeRow

    public boolean removeRow(int pos)
                      throws java.lang.IndexOutOfBoundsException

  Remove a row at position pos from the table

  Parameters:
    `pos` - position the Row in the Table
  Throws:
    `java.lang.IndexOutOfBoundsException`

### getRows

    public java.util.List<XWPFTableRow> getRows()

### getElementType

    public BodyElementType getElementType()

  returns the type of the BodyElement Table

  Specified by:
    `getElementType` in interface `IBodyElement`
  See Also:
    `IBodyElement.getElementType()`

### getPart

    public IBody getPart()

  returns the part of the bodyElement

  Specified by:
    `getPart` in interface `IBodyElement`
  See Also:
    `IBody.getPart()`

### getPartType

    public BodyType getPartType()

  returns the partType of the bodyPart which owns the bodyElement

  Specified by:
    `getPartType` in interface `IBodyElement`
  See Also:
    `IBody.getPartType()`

### getRow

    public XWPFTableRow getRow(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow row)

  returns the XWPFRow which belongs to the CTRow row if this row is not existing in the table null will be returned

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.