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 By default, a cell is created with a single empty paragraph so that it is immediately usable. Additional paragraphs or content can be appended with (which delegates to the last paragraph) or by adding child elements directly. AddText(string)

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 a new node containing to this container. Text text

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.