com.spire.doc
Class Table

java.lang.Object
  extended by com.spire.doc.OwnerHolder
      extended by com.spire.doc.documents.xml.DocumentSerializable
          extended by com.spire.doc.DocumentObject
              extended by com.spire.doc.DocumentBase
                  extended by com.spire.doc.BodyRegion
                      extended by com.spire.doc.Table
All Implemented Interfaces:
IBodyRegion, ICompositeObject, IDocumentObject, IDocumentSerializable, ITable

public class Table
extends BodyRegion
implements ITable


Constructor Summary
Table(IDocument doc)
          Initializes a new instance of the class.
Table(IDocument doc, boolean showBorder)
          Initializes a new instance of the class.
Table(IDocument doc, boolean showBorder, float lineWidth)
           
 
Method Summary
 IParagraph addCaption(java.lang.String name, CaptionNumberingFormat format, CaptionPosition captionPosition)
           Add Caption for current Table
 TableRow addRow()
          Adds a row to table
 TableRow addRow(boolean isCopyFormat)
          Adds new row to table.
 TableRow addRow(boolean isCopyFormat, boolean autoPopulateCells)
          Adds a row to table with copy format option
 TableRow addRow(boolean isCopyFormat, int columnsNum)
          Adds a row to table with copy format option
 TableRow addRow(int columnsNum)
          Adds a row to table with copy format from the current last row, and then add columnsNum cells to the new row.
 void applyHorizontalMerge(int rowIndex, int startCellIndex, int endCellIndex)
          Applies horizontal merging for cells of table row.
 void applyStyle(DefaultTableStyle builtinTableStyle)
          Applies the built-in table style.
 void applyTableStyle()
          Applies the table style properties to table and cell.
 void applyVerticalMerge(int columnIndex, int startRowIndex, int endRowIndex)
          Applies the vertical merge for table cells.
 void autoFit(AutoFitBehaviorType behavior)
          Determines how Microsoft Word resizes a table when the AutoFit feature is used.
 Table deepClone()
          Clones this instance.
 TextSelection find(java.util.regex.Pattern pattern)
          Finds text by specified pattern.
 TableCell get(int row, int column)
          Get table cell by row and column indexes.
 DocumentObjectCollection getChildObjects()
          Gets the child entities.
 float[] getColumnWidth()
          Gets or sets the width of each column.
 int getDefaultColumnsNumber()
          Gets or sets the default column count of per row.
 float getDefaultColumnWidth()
          Gets or sets the default width of each column.
 float getDefaultRowHeight()
          Gets or sets the default row height, the unit of measure is point, 1point = 0.3528 mm
 DocumentObjectType getDocumentObjectType()
          Gets the type of the document object.
 TableRow getFirstRow()
          Get first row of the table.
 float getIndentFromLeft()
          Gets or sets indent from left for the table.
 TableCell getLastCell()
          Get last cell of the table
 TableRow getLastRow()
          Get last row of the table.
 PreferredWidth getPreferredWidth()
          This property specifies the preferred horizontal width of a table.
 RowCollection getRows()
          Get the table rows
 java.lang.String getTableDescription()
          Gets or sets the table description.
 RowFormat getTableFormat()
          Gets the table formatting after ResetCells call.
 java.lang.String getTableStyleName()
          Gets table style name.
 java.lang.String getTitle()
          Gets or sets the table title.
 float getWidth()
          Gets the table width
 void removeAbsPosition()
          Removes the absolute position data.
 int replace(java.util.regex.Pattern pattern, java.lang.String replace)
          Replaces all entries of matchString regular expression with newValue string.
 int replace(java.util.regex.Pattern pattern, TextSelection textSelection)
          Replaces by specified pattern.
 int replace(java.util.regex.Pattern pattern, TextSelection textSelection, boolean saveFormatting)
          Replaces by specified pattern.
 int replace(java.lang.String given, java.lang.String replace, boolean caseSensitive, boolean wholeWord)
          Replaces by specified matchString string.
 void resetCells(int rowsNum, int columnsNum)
          Resets rows / columns numbers.
 void resetCells(int rowsNum, int columnsNum, RowFormat format, float cellWidth)
          Resets rows / columns numbers.
 void setColumnWidth(float[] value)
          Gets or sets the width of each column.
 void setColumnWidth(int columnIndex, float columnWidth, CellWidthType columnWidthType)
          Sets the width of all cells in the current column of the table.
 void setDefaultColumnsNumber(int value)
          Gets or sets the default column count of per row.
 void setDefaultColumnWidth(float value)
          Gets or sets the default width of each column.
 void setDefaultRowHeight(float value)
          Gets or sets the default row height, the unit of measure is point, 1point = 0.3528 mm
 void setIndentFromLeft(float value)
          Gets or sets indent from left for the table.
 void setPreferredWidth(PreferredWidth value)
          This property specifies the preferred horizontal width of a table.
 void setTableDescription(java.lang.String value)
           
 void setTitle(java.lang.String value)
          Gets or sets the table title.
 
Methods inherited from class com.spire.doc.BodyRegion
getDeleteRevision, getInsertRevision, getOwnerTextBody, isDeleteRevision, isInsertRevision
 
Methods inherited from class com.spire.doc.DocumentObject
getFirstChild, getLastChild, getNextSibling, getNextWidgetSibling, getOwner, getPreviousSibling, getPreviousWidgetSibling, isComposite, prependChild, toString
 
Methods inherited from class com.spire.doc.OwnerHolder
getDocument
 
Methods inherited from interface com.spire.doc.interfaces.IDocumentObject
getDocument, getNextSibling, getOwner, getPreviousSibling, isComposite
 

Constructor Detail

Table

public Table(IDocument doc)
Initializes a new instance of the class.

Parameters:
doc - The doc.

Table

public Table(IDocument doc,
             boolean showBorder)
Initializes a new instance of the class.

Parameters:
doc - The doc.
showBorder - if it specifies to show the table border, set to true.

Table

public Table(IDocument doc,
             boolean showBorder,
             float lineWidth)
Method Detail

getDefaultRowHeight

public float getDefaultRowHeight()
Gets or sets the default row height, the unit of measure is point, 1point = 0.3528 mm


setDefaultRowHeight

public void setDefaultRowHeight(float value)
Gets or sets the default row height, the unit of measure is point, 1point = 0.3528 mm


getDefaultColumnsNumber

public int getDefaultColumnsNumber()
Gets or sets the default column count of per row.


setDefaultColumnsNumber

public void setDefaultColumnsNumber(int value)
Gets or sets the default column count of per row.


getDefaultColumnWidth

public float getDefaultColumnWidth()
Gets or sets the default width of each column.


setDefaultColumnWidth

public void setDefaultColumnWidth(float value)
Gets or sets the default width of each column.


getColumnWidth

public float[] getColumnWidth()
Gets or sets the width of each column.


setColumnWidth

public void setColumnWidth(float[] value)
Gets or sets the width of each column.


getDocumentObjectType

public DocumentObjectType getDocumentObjectType()
Gets the type of the document object.

Specified by:
getDocumentObjectType in interface IDocumentObject
Specified by:
getDocumentObjectType in class DocumentObject
Returns:
The type of the document object.

getRows

public RowCollection getRows()
Get the table rows

Specified by:
getRows in interface ITable
Returns:

getTableFormat

public RowFormat getTableFormat()
Gets the table formatting after ResetCells call.

Specified by:
getTableFormat in interface ITable
Returns:
The table format.

getPreferredWidth

public PreferredWidth getPreferredWidth()
This property specifies the preferred horizontal width of a table.


setPreferredWidth

public void setPreferredWidth(PreferredWidth value)
This property specifies the preferred horizontal width of a table.


getTableStyleName

public java.lang.String getTableStyleName()
Gets table style name.

Returns:

getLastCell

public TableCell getLastCell()
Get last cell of the table

Specified by:
getLastCell in interface ITable
Returns:

getFirstRow

public TableRow getFirstRow()
Get first row of the table.

Specified by:
getFirstRow in interface ITable
Returns:

getLastRow

public TableRow getLastRow()
Get last row of the table.

Specified by:
getLastRow in interface ITable
Returns:

get

public TableCell get(int row,
                     int column)
Get table cell by row and column indexes.

Specified by:
get in interface ITable
Parameters:
row -
column -
Returns:

getWidth

public float getWidth()
Gets the table width

Specified by:
getWidth in interface ITable
Returns:

getChildObjects

public DocumentObjectCollection getChildObjects()
Gets the child entities.

Specified by:
getChildObjects in interface ICompositeObject
Specified by:
getChildObjects in class DocumentObject
Returns:
The child entities.

getIndentFromLeft

public float getIndentFromLeft()
Gets or sets indent from left for the table.

Specified by:
getIndentFromLeft in interface ITable
Returns:
The indent

setIndentFromLeft

public void setIndentFromLeft(float value)
Gets or sets indent from left for the table.

Specified by:
setIndentFromLeft in interface ITable
Parameters:
value - The indent

getTitle

public java.lang.String getTitle()
Gets or sets the table title.

Returns:
The title.

setTitle

public void setTitle(java.lang.String value)
Gets or sets the table title.


getTableDescription

public java.lang.String getTableDescription()
Gets or sets the table description.


setTableDescription

public void setTableDescription(java.lang.String value)

addCaption

public IParagraph addCaption(java.lang.String name,
                             CaptionNumberingFormat format,
                             CaptionPosition captionPosition)
Add Caption for current Table

Parameters:
captionPosition -
name -
format -
Returns:

deepClone

public Table deepClone()
Clones this instance.

Specified by:
deepClone in interface IDocumentObject
Overrides:
deepClone in class DocumentObject
Returns:

resetCells

public void resetCells(int rowsNum,
                       int columnsNum)
Resets rows / columns numbers.

Specified by:
resetCells in interface ITable
Parameters:
rowsNum - The rows number.
columnsNum - The columns number.

resetCells

public void resetCells(int rowsNum,
                       int columnsNum,
                       RowFormat format,
                       float cellWidth)
Resets rows / columns numbers.

Specified by:
resetCells in interface ITable
Parameters:
rowsNum - The rows num.
columnsNum - The columns num.
format -
cellWidth - Width of the cell.

applyStyle

public void applyStyle(DefaultTableStyle builtinTableStyle)
Applies the built-in table style.

Parameters:
builtinStyle - The built-in table style.

applyTableStyle

public void applyTableStyle()
Applies the table style properties to table and cell.


addRow

public TableRow addRow()
Adds a row to table

Specified by:
addRow in interface ITable
Returns:

addRow

public TableRow addRow(int columnsNum)
Adds a row to table with copy format from the current last row, and then add columnsNum cells to the new row.

Parameters:
columnsNum - The number of the count of the new row, it's must be -1 < columnsNum < 64.
Returns:

addRow

public TableRow addRow(boolean isCopyFormat)
Adds new row to table.

Specified by:
addRow in interface ITable
Parameters:
isCopyFormat -
Returns:

addRow

public TableRow addRow(boolean isCopyFormat,
                       boolean autoPopulateCells)
Adds a row to table with copy format option

Specified by:
addRow in interface ITable
Parameters:
isCopyFormat - Indicates whether copy format from previous row or not
autoPopulateCells - if specifies to populate cells automatically, set to true.
Returns:

addRow

public TableRow addRow(boolean isCopyFormat,
                       int columnsNum)
Adds a row to table with copy format option

Parameters:
isCopyFormat - Indicates whether copy format from previous row or not
columnsNum - The number of the count of the new row, it's must be -1 < columnsNum < 64.
Returns:

replace

public int replace(java.util.regex.Pattern pattern,
                   java.lang.String replace)
Replaces all entries of matchString regular expression with newValue string.

Specified by:
replace in interface IBodyRegion
Specified by:
replace in class BodyRegion
Parameters:
pattern - Pattern
replace - Replace text
Returns:
int

replace

public int replace(java.lang.String given,
                   java.lang.String replace,
                   boolean caseSensitive,
                   boolean wholeWord)
Replaces by specified matchString string.

Specified by:
replace in class BodyRegion
Parameters:
matchString - The matchString text.
newValue - The newValue text.
caseSensitive - if it specifies case sensitive, set to true.
wholeWord - if it specifies to search a whole word, set to true.
Returns:

replace

public int replace(java.util.regex.Pattern pattern,
                   TextSelection textSelection)
Replaces by specified pattern.

Specified by:
replace in interface IBodyRegion
Specified by:
replace in class BodyRegion
Parameters:
pattern - The pattern.
textSelection - The text selection.
Returns:
int

replace

public int replace(java.util.regex.Pattern pattern,
                   TextSelection textSelection,
                   boolean saveFormatting)
Replaces by specified pattern.

Specified by:
replace in class BodyRegion
Parameters:
pattern - The pattern.
textSelection - The text selection.
saveFormatting - if save source formatting, set to true
Returns:
int

find

public TextSelection find(java.util.regex.Pattern pattern)
Finds text by specified pattern.

Specified by:
find in class BodyRegion
Parameters:
pattern - The pattern.
Returns:
TextSelection

applyVerticalMerge

public void applyVerticalMerge(int columnIndex,
                               int startRowIndex,
                               int endRowIndex)
Applies the vertical merge for table cells.

Specified by:
applyVerticalMerge in interface ITable
Parameters:
columnIndex - Index of the column.
startRowIndex - Start index of the row.
endRowIndex - End index of the row.

applyHorizontalMerge

public void applyHorizontalMerge(int rowIndex,
                                 int startCellIndex,
                                 int endCellIndex)
Applies horizontal merging for cells of table row.

Specified by:
applyHorizontalMerge in interface ITable
Parameters:
rowIndex - Index of the row.
startCellIndex - Start index of the cell.
endCellIndex - End index of the cell.

removeAbsPosition

public void removeAbsPosition()
Removes the absolute position data. If table has absolute position in the document, all position data will be erased.

Specified by:
removeAbsPosition in interface ITable

setColumnWidth

public void setColumnWidth(int columnIndex,
                           float columnWidth,
                           CellWidthType columnWidthType)
Sets the width of all cells in the current column of the table.

Parameters:
columnIndex - Index of the column.
columnWidth - The column width.
columnWidthType - The column width type.

autoFit

public void autoFit(AutoFitBehaviorType behavior)
Determines how Microsoft Word resizes a table when the AutoFit feature is used.

Parameters:
behavior - How Word resizes the specified table with the AutoFit feature is used.