Class TableCell
Represents a cell element within a table.
Implements
Inherited Members
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class TableCell : TableElements, IDocumentElement, IDocumentObject, ICloneable, IElementContainer, ITextContainer, IDrawContainer
Constructors
TableCell()
Initializes a new instance of the TableCell class.
Declaration
public TableCell()
TableCell(ContentElement[])
Initializes a new instance of the TableCell class with the specified contents.
Declaration
public TableCell(params ContentElement[] contents)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentElement[] | contents | The ContentElement objects representing the initial contents of the cell. |
TableCell(String)
Initializes a new instance of the TableCell class with the specified value.
Declaration
public TableCell(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The cell value. |
Properties
BottomMargin
Gets or sets the margin size at the bottom of the page in Inches.
Declaration
public double BottomMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Contents
Gets a list of ContentElement objects representing the content of the cell.
Declaration
public List<ContentElement> Contents { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ContentElement> |
FitText
Gets or sets the Sets the cell text content feature to fit cell.
Declaration
public bool FitText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
GridSpan
Gets or sets the Grid span of the table cell.
Declaration
public int GridSpan { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Index
Gets the index of this cell within the parent row's list of children.
Declaration
public int Index { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
LeftMargin
Gets or sets the margin size at the left of the page in Inches.
Declaration
public double LeftMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
MultiLevelTextLists
Gets a list of all Shape elements contained within this TableCell.
Declaration
public List<MultiLevelTextList> MultiLevelTextLists { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<MultiLevelTextList> | A List object containing all Shape elements. |
Paragraphs
Gets a list of all Paragraph elements contained within this TableCell.
Declaration
public List<Paragraph> Paragraphs { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Paragraph> | A List object containing all Paragraph elements. |
RightMargin
Gets or sets the margin size at the right of the page in Inches.
Declaration
public double RightMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Shading
Gets or sets the Sets the color of the shading and fill of the table cell.
Declaration
public Shading Shading { get; set; }
Property Value
| Type | Description |
|---|---|
| Shading |
TextAlignment
Gets or sets the horizontal alignment of the text content within the cell.
Declaration
public JustificationValues TextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| JustificationValues |
TopMargin
Gets or sets the margin size at the top of the page in Inches.
Declaration
public double TopMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Value
Raw value of the cell
Declaration
public string Value { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
VerticalAlignment
Gets or sets the vertical alignment of the content within the cell.
Declaration
public VerticalAlign VerticalAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| VerticalAlign |
Width
Gets or sets the width of the table cell.
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
AddChild(ContentElement[])
Adds one or more child content elements to the current content element.
Declaration
public override void AddChild(params ContentElement[] children)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentElement[] | children | The content elements to be added as children. |
Overrides
AddImage(AnyBitmap)
Adds an image to this TableCell from an IronSoftware.Drawing.AnyBitmap object.
Declaration
public ImageContent AddImage(AnyBitmap anyBitmap)
Parameters
| Type | Name | Description |
|---|---|---|
| IronSoftware.Drawing.AnyBitmap | anyBitmap |
Returns
| Type | Description |
|---|---|
| ImageContent |
AddImage(ImageContent)
Adds an image to the TableCell.
Declaration
public ImageContent AddImage(ImageContent imageContent)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageContent | imageContent | The Image to be added. |
Returns
| Type | Description |
|---|---|
| ImageContent | The added Image. |
AddImage(Stream)
Adds an image to the TableCell.
Declaration
public ImageContent AddImage(Stream imageStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | imageStream | The stream image to be loaded. |
Returns
| Type | Description |
|---|---|
| ImageContent | The added Image. |
AddImage(String)
Adds an image to the TableCell.
Declaration
public ImageContent AddImage(string imagePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | imagePath | The physical path of Image to be loaded. |
Returns
| Type | Description |
|---|---|
| ImageContent | The added Image. |
AddMultiLevelTextList(MultiLevelTextList)
Adds a multi-level text list to the TableCell.
Declaration
public MultiLevelTextList AddMultiLevelTextList(MultiLevelTextList multiLevelTextList)
Parameters
| Type | Name | Description |
|---|---|---|
| MultiLevelTextList | multiLevelTextList | The MultiLevelTextList to be added. |
Returns
| Type | Description |
|---|---|
| MultiLevelTextList | The added MultiLevelTextList. |
AddParagraph(Paragraph)
Adds a paragraph to the TableCell.
Declaration
public Paragraph AddParagraph(Paragraph paragraph)
Parameters
| Type | Name | Description |
|---|---|---|
| Paragraph | paragraph | The Paragraph to be added. |
Returns
| Type | Description |
|---|---|
| Paragraph | The added Paragraph. |
AddShape(ShapeContent)
Adds a shape to the TableCell.
Declaration
public ShapeContent AddShape(ShapeContent shapeContent)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeContent | shapeContent | The Shape to be added. |
Returns
| Type | Description |
|---|---|
| ShapeContent | The added Shape. |
AddTable(Table)
Adds a table to the TableCell.
Declaration
public Table AddTable(Table table)
Parameters
| Type | Name | Description |
|---|---|---|
| Table | table | The table to be added. |
Returns
| Type | Description |
|---|---|
| Table | The added Table. |
AddText(TextContent)
Adds a Text to the TableCell.
Declaration
public TextContent AddText(TextContent textContent)
Parameters
| Type | Name | Description |
|---|---|---|
| TextContent | textContent | The Text to be added. |
Returns
| Type | Description |
|---|---|
| TextContent | The added Text. |
AddText(String)
Adds text to the TableCell.
Declaration
public TextContent AddText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to be added. |
Returns
| Type | Description |
|---|---|
| TextContent | The added Run. |
CloneStruct()
Creates and returns a new instance of TableCell with the same structure as the current Cell except contents.
Declaration
public TableCell CloneStruct()
Returns
| Type | Description |
|---|---|
| TableCell | A cloned TableCell with the same structure as the current cell with empty content. |
ExtractText()
Extract all text from the container
Declaration
public string ExtractText()
Returns
| Type | Description |
|---|---|
| System.String | Extracted text |
FindText(String)
Find the first text element which contains the specified text
Declaration
public TextContent FindText(string find)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | find | Text to find |
Returns
| Type | Description |
|---|---|
| TextContent | Text element containing the specified text |
GetWidth(MeasurementUnit)
Gets the width of the TableCell in the specified measurement unit.
Declaration
public double GetWidth(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The measurement unit for the width. Default is twentieths of a point (Twips). |
Returns
| Type | Description |
|---|---|
| System.Double | The width of the TableCell in the specified measurement unit. |
InsertCellAfterSelf(TableCell)
Inserts a new TableCell after this cell within the parent row.
Declaration
public TableCell InsertCellAfterSelf(TableCell cell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | cell | The TableCell object to be inserted after this cell. |
Returns
| Type | Description |
|---|---|
| TableCell |
InsertCellBeforeSelf(TableCell)
Inserts a new TableCell before this cell within the parent row.
Declaration
public TableCell InsertCellBeforeSelf(TableCell cell)
Parameters
| Type | Name | Description |
|---|---|---|
| TableCell | cell | The TableCell object to be inserted before this cell. |
Returns
| Type | Description |
|---|---|
| TableCell |
Remove(TextContent)
Remove the specified text element
Declaration
public bool Remove(TextContent element)
Parameters
| Type | Name | Description |
|---|---|---|
| TextContent | element | Text element to remove |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the element was found and removed, False otherwise |
ReplaceText(String, String)
Replace all instances of the specified text
Declaration
public void ReplaceText(string find, string replace)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | find | Text to replace |
| System.String | replace | Replacement text |
SetContent(ContentElement)
Sets the content of the TableCell.
Declaration
public TableCell SetContent(ContentElement content)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentElement | content | The ContentElement to set as the content of the TableCell. |
Returns
| Type | Description |
|---|---|
| TableCell | The modified TableCell. |
SetWidth(Double, MeasurementUnit)
Set the width of the TableCell in the specified measurement unit.
Declaration
public TableCell SetWidth(double width, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | the width of the TableCell. |
| MeasurementUnit | measurementUnit | The measurement unit for the width. Default is twentieths of a point (Twips). |
Returns
| Type | Description |
|---|---|
| TableCell | The width of the TableCell in the specified measurement unit. |
Split(Int32, Int32)
Splits a cell in the table into multiple rows and columns.
Declaration
public TableCell Split(int toRow, int toColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | toRow | The number of the row for the split. |
| System.Int32 | toColumn | The number of columns for the split. |
Returns
| Type | Description |
|---|---|
| TableCell |