API Reference
WordTableCell
Represents a single cell within a WordTable.
Inheritance
- Object
- WordTableCell
Constructors
public WordTableCell(WordDocument document, WordTable wordTable, WordTableRow wordTableRow) #Create a WordTableCell and add it to given Table Row
Parameters
- document OfficeIMO.Word.WordDocument
- wordTable OfficeIMO.Word.WordTable
- wordTableRow OfficeIMO.Word.WordTableRow
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
- wordTable OfficeIMO.Word.WordTable
- wordTableRow OfficeIMO.Word.WordTableRow
- tableCell DocumentFormat.OpenXml.Wordprocessing.TableCell
- ensureCellProperties System.Boolean
- When true, provisions missing table cell properties to support editing.
Methods
public WordList AddList(WordListStyle style) #WordListCreates a list within this table cell using the specified style.
Parameters
- style OfficeIMO.Word.WordListStyle
- List style to apply.
Returns
The created WordList.
public WordParagraph AddParagraph(WordParagraph paragraph = null, Boolean removeExistingParagraphs = false) #WordParagraphAdd paragraph to the table cell
Parameters
- paragraph OfficeIMO.Word.WordParagraph = null
- 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
- 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) #WordParagraphAdd paragraph to the table cell with text
Parameters
- text System.String
- removeExistingParagraphs System.Boolean = false
public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid, Boolean removePrecedingParagraph = false) #WordTableAdd table to a table cell (nested table)
Parameters
- rows System.Int32
- columns System.Int32
- tableStyle OfficeIMO.Word.WordTableStyle = TableGrid
- removePrecedingParagraph System.Boolean = false
AddTableCellProperties() #Ensure that TableCellProperties exist for current cell
CleanupTableCellMargin() #Removes the TableCellMargin element if it has no child elements.
public Void MergeHorizontally(Int32 cellsCount, Boolean copyParagraphs = false) #VoidMerges two or more cells together horizontally. Provides ability to move or delete content of merged cells into single cell
Parameters
- cellsCount System.Int32
- copyParagraphs System.Boolean = false
public Void MergeVertically(Int32 cellsCount, Boolean copyParagraphs = false) #VoidMerges two or more cells together vertically
Parameters
- cellsCount System.Int32
- copyParagraphs System.Boolean = false
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
- right OfficeIMO.Word.WordTableCell
op_Inequality(OfficeIMO.Word.WordTableCell left, OfficeIMO.Word.WordTableCell right) #Determines whether two cells are not equal.
Parameters
- left OfficeIMO.Word.WordTableCell
- right OfficeIMO.Word.WordTableCell
RemoveTableCellProperties() #Remove TableCellProperties from current cell (used mostly for testing)
public Void SplitHorizontally(Int32 cellsCount) #VoidSplits (unmerge) cells that were merged
Parameters
- cellsCount System.Int32
public Void SplitVertically(Int32 cellsCount) #VoidSplits (unmerge) cells that were merged vertically
Parameters
- cellsCount System.Int32
- Number of cells to split including the current one
Inherited Methods
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