com.aspose.pdf.elements
Class Table

java.lang.Object
  extended by com.aspose.pdf.elements.PdfElementBase
      extended by com.aspose.pdf.elements.Paragraph
          extended by com.aspose.pdf.elements.Table
All Implemented Interfaces:
java.lang.Cloneable

public class Table
extends Paragraph

Represents a table Paragraph in a Pdf document.


Constructor Summary
Table(Cell cell)
          Initializes a new instance of the Table class in the Cell.
Table(Section section)
          Initialize a new instance of the Table class.
 
Method Summary
 Color getBackgroundColor()
          Gets Color object that indicates the background color of the table.
 BorderInfo getBorder()
          Gets a BorderInfo object that indicates the table border info.
 java.lang.String getColumnWidths()
          Gets a string that contains the width of each columns in this table.
The value of each column should be separated by blank.The default unit is point,
but cm and inch are also supported.For example,"120 2.5cm 1.5inch".
 AlignmentType getDefaultCellAlignmentType()
          Gets a default AlignmentType that indicates the cell alignment type.
 BorderInfo getDefaultCellBorder()
          Gets a BorderInfo object that indicates the default border style for all cells in this table.
 MarginInfo getDefaultCellPadding()
          Gets a MarginInfo object that indicates the default cell padding in the table.
 TextInfo getDefaultCellTextInfo()
          Gets a TextInfo object that indicates the default cell text format info.
 org.w3c.dom.Element getDOMElement()
          Gets a DOM representation of the pdf element.
 float getFixedWidth()
          Gets a float value that indicates the fixed width of the table.
 AlignmentType getHorizontalAlignment()
          Gets an alignment type that indicates the table alignment mode.
 Rows getRows()
          Gets a Rows collection that indicates all rows in the table.
 java.lang.String getVerticalAlignment()
          Gets a VerticalAlignmentType that indicates the vertical alignment type.
 boolean isBroken()
          Gets a bool value that indicates whether the table is broken or not.
 boolean isFirstRowRepeated()
          Gets a bool value that indicates whether the first row is repeated when its table is broken.
 boolean isRowBroken()
          Gets a bool value that indicates whether the row can be broken
or not when its table is broken.
 boolean isSingleHeaderShown()
          A bool value that indicates whether table with only a header
(IsFirstRowRepeated=true and Rows.Count=1) be shown.
 void setBackgroundColor(Color color)
          Sets a Color object that indicates the background color of the table.
 void setBorder(BorderInfo border)
          Sets a BorderInfo object that indicates the table border info.
 void setColumnWidths(java.lang.String widths)
          Sets a string that contains the width of each columns in this table.
The value of each column should be separated by blank.The default unit is point,
but cm and inch are also supported.For example,"120 2.5cm 1.5inch".
 void setDefaultCellAlignmentType(AlignmentType type)
          Sets a default AlignmentType that indicates the cell alignment type.
 void setDefaultCellBorder(BorderInfo cellBorder)
          Sets a BorderInfo object that indicates the default border style for all cells in this table.
 void setDefaultCellPadding(MarginInfo cellPadding)
          Sets a MarginInfo object that indicates the default cell padding in the table.
 void setDefaultCellTextInfo(TextInfo defaultCellTextInfo)
          Sets a TextInfo object that indicates the default cell text format info.
 void setFixedWidth(float width)
          sets a float value that indicates the fixed width of the table.
 void setHorizontalAlignment(AlignmentType horizontalAlignment)
          Sets a alignment type that indicates the table alignment mode.
 void setIsBroken(boolean broken)
          Sets a bool value that indicates whether the table is broken or not.
 void setIsFirstRowRepeated(boolean firstRowRepeated)
          Sets a bool value that indicates whether the first row is repeated when its table is broken.
 void setIsRowBroken(boolean rowBroken)
          Sets a bool value that indicates whether the row can be broken
or not when its table is broken.
 void setIsSingleHeaderShown(boolean singleHeaderShown)
          A bool value that indicates whether table with only a header
(IsFirstRowRepeated=true and Rows.Count=1) be shown.
 void setVerticalAlignment(java.lang.String alignmentType)
          Sets a VerticalAlignmentType that indicates the vertical alignment type.
 
Methods inherited from class com.aspose.pdf.elements.Paragraph
clone, getLeft, getMargin, getTop, isDisabled, isFirstParagraph, isKeptTogether, isOnOddPage, setDisabled, setFirstParagraph, setKeptTogether, setLeft, setMargin, setOnOddPage, setTop
 
Methods inherited from class com.aspose.pdf.elements.PdfElementBase
getElementFactory, getID, getNameIndex, setID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table(Section section)
Initialize a new instance of the Table class.

 [SampleCode]
 Pdf pdf = new Pdf();
 Section sec1 = pdf.getSections().add();
 Table table = new Table(sec1);
 table.setColumnWidths(new float[]{150,150});
 Row row1 = new Row(table);
 table.getRows().add(row1);
 Text someText = new Text(sec1,"some text");
 Cell cell11 = new Cell(table);
 cell11.getParagraphs().add(someText);
 row1.getCells().add(cell11);
 Text otherText = new Text(sec1,"some more text");
 Cell cell12 = new Cell(table);
 cell12.getParagraphs().add(otherText);
 row1.getCells().add(cell12);
 

Parameters:
section - The section that owns the Table paragraph.

Table

public Table(Cell cell)
Initializes a new instance of the Table class in the Cell.

Method Detail

getHorizontalAlignment

public AlignmentType getHorizontalAlignment()
Gets an alignment type that indicates the table alignment mode.


setHorizontalAlignment

public void setHorizontalAlignment(AlignmentType horizontalAlignment)
Sets a alignment type that indicates the table alignment mode.


getRows

public Rows getRows()
Gets a Rows collection that indicates all rows in the table.


getDefaultCellPadding

public MarginInfo getDefaultCellPadding()
Gets a MarginInfo object that indicates the default cell padding in the table.


setDefaultCellPadding

public void setDefaultCellPadding(MarginInfo cellPadding)
Sets a MarginInfo object that indicates the default cell padding in the table.


getBackgroundColor

public Color getBackgroundColor()
Gets Color object that indicates the background color of the table.


setBackgroundColor

public void setBackgroundColor(Color color)
Sets a Color object that indicates the background color of the table.

Parameters:
color - The backgroundColor to set.

getDefaultCellAlignmentType

public AlignmentType getDefaultCellAlignmentType()
Gets a default AlignmentType that indicates the cell alignment type. Default value is AlignmentType.Left.


setDefaultCellAlignmentType

public void setDefaultCellAlignmentType(AlignmentType type)
Sets a default AlignmentType that indicates the cell alignment type.


getDefaultCellBorder

public BorderInfo getDefaultCellBorder()
Gets a BorderInfo object that indicates the default border style for all cells in this table.


setDefaultCellBorder

public void setDefaultCellBorder(BorderInfo cellBorder)
Sets a BorderInfo object that indicates the default border style for all cells in this table.


getDefaultCellTextInfo

public TextInfo getDefaultCellTextInfo()
Gets a TextInfo object that indicates the default cell text format info.


setDefaultCellTextInfo

public void setDefaultCellTextInfo(TextInfo defaultCellTextInfo)
Sets a TextInfo object that indicates the default cell text format info.

Parameters:
defaultCellTextInfo - The Default Cell TextInfo to set.

getColumnWidths

public java.lang.String getColumnWidths()
Gets a string that contains the width of each columns in this table.
The value of each column should be separated by blank.The default unit is point,
but cm and inch are also supported.For example,"120 2.5cm 1.5inch". The max column number is 1024.

Returns:
Returns the column Width as array.

setColumnWidths

public void setColumnWidths(java.lang.String widths)
Sets a string that contains the width of each columns in this table.
The value of each column should be separated by blank.The default unit is point,
but cm and inch are also supported.For example,"120 2.5cm 1.5inch". The max column number is 1024.

Parameters:
widths - The column Widths to set.

getVerticalAlignment

public java.lang.String getVerticalAlignment()
Gets a VerticalAlignmentType that indicates the vertical alignment type.


setVerticalAlignment

public void setVerticalAlignment(java.lang.String alignmentType)
Sets a VerticalAlignmentType that indicates the vertical alignment type.

See Also:
VerticalAlignmentType

getBorder

public BorderInfo getBorder()
Gets a BorderInfo object that indicates the table border info. null indicates no BorderInfo has been set.

Returns:
Returns the table BorderInfo.

setBorder

public void setBorder(BorderInfo border)
Sets a BorderInfo object that indicates the table border info.

Parameters:
border - The Table BorderInfo to set.

isSingleHeaderShown

public boolean isSingleHeaderShown()
A bool value that indicates whether table with only a header
(IsFirstRowRepeated=true and Rows.Count=1) be shown.
The default value is true.

Returns:
Returns the IsSingleHeaderShown.

setIsSingleHeaderShown

public void setIsSingleHeaderShown(boolean singleHeaderShown)
A bool value that indicates whether table with only a header
(IsFirstRowRepeated=true and Rows.Count=1) be shown.
The default value is true.

Parameters:
singleHeaderShown - The IsSingleHeaderShown to set.

isBroken

public boolean isBroken()
Gets a bool value that indicates whether the table is broken or not.

Returns:
Returns the IsBroken.

setIsBroken

public void setIsBroken(boolean broken)
Sets a bool value that indicates whether the table is broken or not.

Parameters:
broken - The IsBroken to set.

isFirstRowRepeated

public boolean isFirstRowRepeated()
Gets a bool value that indicates whether the first row is repeated when its table is broken.

Returns:
Returns the IsFirstRowRepeated.

setIsFirstRowRepeated

public void setIsFirstRowRepeated(boolean firstRowRepeated)
Sets a bool value that indicates whether the first row is repeated when its table is broken.

Parameters:
firstRowRepeated - The IsFirstRowRepeated to set.

isRowBroken

public boolean isRowBroken()
Gets a bool value that indicates whether the row can be broken
or not when its table is broken. Default value is true.

Returns:
Returns the IsRowBroken.

setIsRowBroken

public void setIsRowBroken(boolean rowBroken)
Sets a bool value that indicates whether the row can be broken
or not when its table is broken. Default value is true.

Parameters:
rowBroken - The IsRowBroken to set.

getDOMElement

public org.w3c.dom.Element getDOMElement()
                                  throws AsposeBaseException
Description copied from class: PdfElementBase
Gets a DOM representation of the pdf element.

Overrides:
getDOMElement in class Paragraph
Throws:
AsposeBaseException
See Also:
PdfElementBase.getDOMElement()

getFixedWidth

public float getFixedWidth()
Gets a float value that indicates the fixed width of the table.

Returns:
Returns the FixedWidth. NOTE: This member is now obsolete. You should use ColumnWidths to set the column width of the table. Aspose apologizes for any inconvenience you may have experienced.

setFixedWidth

public void setFixedWidth(float width)
sets a float value that indicates the fixed width of the table. Gets or sets a float value that indicates the fixed width of the table.

Parameters:
width - The FixedWidth to set. NOTE: This member is now obsolete. You should use ColumnWidths to set the column width of the table. Aspose apologizes for any inconvenience you may have experienced.