OfficeIMO

API Reference

Class

WordTableCell

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word
Implements
IEquatable<WordTableCell>

Represents a single cell within a WordTable.

Inheritance

  • Object
  • WordTableCell

Constructors

WordTableCell 2 overloads
public WordTableCell(WordDocument document, WordTable wordTable, WordTableRow wordTableRow) #

Create a WordTableCell and add it to given Table Row

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
wordTable OfficeIMO.Word.WordTable requiredposition: 1
wordTableRow OfficeIMO.Word.WordTableRow requiredposition: 2
WordTableCell(OfficeIMO.Word.WordDocument document, OfficeIMO.Word.WordTable wordTable, OfficeIMO.Word.WordTableRow wordTableRow, DocumentFormat.OpenXml.Wordprocessing.TableCell tableCell, System.Boolean ensureCellProperties) #

Create a WordTableCell and add it to given Table Row from TableCell Mostly used for loading TableCells during Document Load

Parameters

document OfficeIMO.Word.WordDocument required
wordTable OfficeIMO.Word.WordTable required
wordTableRow OfficeIMO.Word.WordTableRow required
tableCell DocumentFormat.OpenXml.Wordprocessing.TableCell required
ensureCellProperties System.Boolean required
When true, provisions missing table cell properties to support editing.

Methods

public WordList AddList(WordListStyle style) #
Returns: WordList

Creates a list within this table cell using the specified style.

Parameters

style OfficeIMO.Word.WordListStyle requiredposition: 0
List style to apply.

Returns

The created WordList.

AddParagraph 2 overloads
public WordParagraph AddParagraph(WordParagraph paragraph = null, Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Add paragraph to the table cell

Parameters

paragraph OfficeIMO.Word.WordParagraph = null optionalposition: 0
The paragraph to add to this cell, if this is not passed then a new empty paragraph with settings from the previous paragraph will be added.
removeExistingParagraphs System.Boolean = false optionalposition: 1
If value is not passed or false then add the given paragraph into the cell. If set to true then clear every existing paragraph before adding the new paragraph.

Returns

A reference to the added paragraph.

public WordParagraph AddParagraph(String text, Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Add paragraph to the table cell with text

Parameters

text System.String requiredposition: 0
removeExistingParagraphs System.Boolean = false optionalposition: 1
public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid, Boolean removePrecedingParagraph = false) #
Returns: WordTable

Add table to a table cell (nested table)

Parameters

rows System.Int32 requiredposition: 0
columns System.Int32 requiredposition: 1
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optionalposition: 2
removePrecedingParagraph System.Boolean = false optionalposition: 3
AddTableCellProperties() #

Ensure that TableCellProperties exist for current cell

CleanupTableCellMargin() #

Removes the TableCellMargin element if it has no child elements.

Equals 2 overloads
public virtual Boolean Equals(WordTableCell other) #
Returns: Boolean

Determines whether this instance and another cell reference the same underlying OpenXML cell.

Parameters

other OfficeIMO.Word.WordTableCell requiredposition: 0
public override Boolean Equals(Object obj) #
Returns: Boolean

Parameters

obj System.Object requiredposition: 0
public override Int32 GetHashCode() #
Returns: Int32
public Void MergeHorizontally(Int32 cellsCount, Boolean copyParagraphs = false) #
Returns: Void

Merges two or more cells together horizontally. Provides ability to move or delete content of merged cells into single cell

Parameters

cellsCount System.Int32 requiredposition: 0
copyParagraphs System.Boolean = false optionalposition: 1
public Void MergeVertically(Int32 cellsCount, Boolean copyParagraphs = false) #
Returns: Void

Merges two or more cells together vertically

Parameters

cellsCount System.Int32 requiredposition: 0
copyParagraphs System.Boolean = false optionalposition: 1
op_Equality(OfficeIMO.Word.WordTableCell left, OfficeIMO.Word.WordTableCell right) #

Compares two cells for equality based on the underlying OpenXML cell reference.

Parameters

left OfficeIMO.Word.WordTableCell required
right OfficeIMO.Word.WordTableCell required
op_Inequality(OfficeIMO.Word.WordTableCell left, OfficeIMO.Word.WordTableCell right) #

Determines whether two cells are not equal.

Parameters

left OfficeIMO.Word.WordTableCell required
right OfficeIMO.Word.WordTableCell required
public Void Remove() #
Returns: Void

Remove a cell from a table

RemoveTableCellProperties() #

Remove TableCellProperties from current cell (used mostly for testing)

public Void SplitHorizontally(Int32 cellsCount) #
Returns: Void

Splits (unmerge) cells that were merged

Parameters

cellsCount System.Int32 requiredposition: 0
public Void SplitVertically(Int32 cellsCount) #
Returns: Void

Splits (unmerge) cells that were merged vertically

Parameters

cellsCount System.Int32 requiredposition: 0
Number of cells to split including the current one

Properties

public WordTableCellBorder Borders { get; } #

Provides access to the border configuration of the cell.

public List<WordParagraph> Paragraphs { get; } #

Gets all WordParagraph instances contained in the cell.

public List<WordElement> Elements { get; } #

Gets the direct child elements contained in the cell in document order.

public WordTableRow Parent { get; } #

Gets the row that owns this cell.

public WordTable ParentTable { get; } #

Gets the table that owns this cell.

public Nullable<MergedCellValues> HorizontalMerge { get; set; } #

Gets or Sets Horizontal Merge for a Table Cell

public Nullable<MergedCellValues> VerticalMerge { get; set; } #

Gets or Sets Vertical Merge for a Table Cell

public Boolean HasHorizontalMerge { get; } #

Gets information whether the cell is part of a horizontal merge

public Boolean HasVerticalMerge { get; } #

Gets information whether the cell is part of a vertical merge

public String ShadingFillColorHex { get; set; } #

Get or set the background color of the cell using hexadecimal color code.

public Nullable<ShadingPatternValues> ShadingPattern { get; set; } #

Get or set the background pattern of a cell

public Nullable<Color> ShadingFillColor { get; set; } #

Get or set the background color of a cell using SixLabors.Color

public Nullable<Int32> Width { get; set; } #

Gets or sets cell width

public Nullable<TableWidthUnitValues> WidthType { get; set; } #

Gets or sets cell width type

public Nullable<TextDirectionValues> TextDirection { get; set; } #

Gets or sets text direction in a Table Cell

public Nullable<TableVerticalAlignmentValues> VerticalAlignment { get; set; } #

Gets or sets cell vertical alignment in a Table Cell

public Nullable<Int16> MarginTopWidth { get; set; } #

Gets or sets the top margin in twips for the current cell.

public Nullable<Int16> MarginBottomWidth { get; set; } #

Gets or sets the bottom margin in twips for the current cell.

public Nullable<Int16> MarginLeftWidth { get; set; } #

Gets or sets the left margin in twips for the current cell.

public Nullable<Int16> MarginRightWidth { get; set; } #

Gets or sets the right margin in twips for the current cell.

public Nullable<Double> MarginTopCentimeters { get; set; } #

Gets or sets the top margin in centimeters for the current cell.

public Nullable<Double> MarginBottomCentimeters { get; set; } #

Gets or sets the bottom margin in centimeters for the current cell.

public Nullable<Double> MarginLeftCentimeters { get; set; } #

Gets or sets the left margin in centimeters for the current cell.

public Nullable<Double> MarginRightCentimeters { get; set; } #

Gets or sets the right margin in centimeters for the current cell.

public Boolean WrapText { get; set; } #

Gets or sets whether text wraps within the cell.

public Boolean FitText { get; set; } #

Gets or sets whether text is compressed to fit within the cell width.

public Boolean HasNestedTables { get; } #

Gets information whether the cell contains other nested tables

public List<WordTable> NestedTables { get; } #

Get all nested tables in the cell