VegaRise.NET
Back to DOM

TableCellClass

Definition

Namespace
DOM.Elements.TableElements
Assembly
DOM.dll

Represents a single cell within a table.

Remarks

A is a container for any inline or block content: paragraphs, text runs, images, shapes, or nested elements. It corresponds to a <w:tc> element in WordprocessingML and to a <td> in HTML. TableCell A new cell holds a single empty placeholder paragraph, so an empty cell is still valid in Word. The first content added to the cell replaces it, whichever method adds it, so no empty line is left above. and append to the cell's last paragraph; the other methods add new elements after the existing ones. Add* Add* AddText(string) AddText(IText)

Examples

csharp
1// 1. Create a cell with a single text run
2var cell = new TableCell();
3cell.AddText("Hello");
4
csharp
1// 2. Replace cell content entirely
2var cell = new TableCell();
3cell.SetContent(new Paragraph().AddText("Replaced"));
4
csharp
1// 3. Style the cell
2var cell = new TableCell
3{
4 Style = new TableCellStyle
5 {
6 VerticalAlignment = TableVerticalAlignmentValues.Center,
7 Justification = TableJustificationValues.Center,
8 }
9};
10cell.AddText("Centered");
11
csharp
1// 4. Insert an image inside a cell
2var cell = new TableCell();
3cell.AddImage("logo.png").SetDimensions(40, 20, Units.Pt);
4

Constructors

TableCell()

Initializes a new instance of the class. TableCell

Properties

Gets or sets the style applied to this table cell.

Methods

Adds to the cell. The first content added to a new cell replaces its empty placeholder paragraph. children

Adds a new node containing to this cell. Text text

Returns true while the cell holds nothing but its unchanged placeholder paragraph.

Sets the content of the current cell.

Splits the current cell into multiple cells, covering the specified row and column span.

VegaRise.NET

Sign In

Welcome back. Please sign in to your account.

Forgot password?
or

Don't have an account? Create an account

By signing in, you agree to our Terms of Service and Privacy Policy.