Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}Represents a table cell in a table in the Word document.{excerpt}
{signature:C#}
 public sealed class TableCell : Element
{signature}{signature:vb.net}
Public NotInheritable Class TableCell
		Inherits Element
{signature}
{remarks}New table cells are created when you create a new [Table|Table]. They cannot be created independent of a Table using the {{new}} keyword.

To retrieve and manipulate a table cell, use array index notation on a {{Table}} object. You can also use [Element.GetElements(Element.Type.TableCell)|Element.GetElements(Element.Type)] to get all elements, of which you can check which ones are of type [TableCell|TableCell].

The following sample demonstrates getting a reference to a table cell at column 3 \(4th column\), row 2 \(3rd row\).

{remarks}
{example}{code:csharp|title=C#}

          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Table table = (Table)doc.GetElements(Element.Type.Table)[0];
          TableCell cell = table[3, 2];
        {code}
{code:vb.net|title=vb.net}

          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim table As Table = doc.GetElements(Element.Type.Table)(0)
          Dim cell As TableCell = table(3, 2)
        {code}

{example}
{properties}
||Name||Description||
|[CellWidthUnits|TableCell.CellWidthUnits]|{excerpt-include:TableCell.CellWidthUnits|nopanel=true}|
|[FirstMerged|TableCell.FirstMerged]|{excerpt-include:TableCell.FirstMerged|nopanel=true}|
|[FirstVerticalMerged|TableCell.FirstVerticalMerged]|{excerpt-include:TableCell.FirstVerticalMerged|nopanel=true}|
|[Merged|TableCell.Merged]|{excerpt-include:TableCell.Merged|nopanel=true}|
|[NoWrap|TableCell.NoWrap]|{excerpt-include:TableCell.NoWrap|nopanel=true}|
|[PreferredWidth|TableCell.PreferredWidth]|{excerpt-include:TableCell.PreferredWidth|nopanel=true}|
|[Shading|TableCell.Shading]|{excerpt-include:TableCell.Shading|nopanel=true}|
|[VertAlignment|TableCell.VertAlignment]|{excerpt-include:TableCell.VertAlignment|nopanel=true}|
|[VerticalMerged|TableCell.VerticalMerged]|{excerpt-include:TableCell.VerticalMerged|nopanel=true}|
{methods}
||Name||Description||
|[ApplyFont(Font)|TableCell.ApplyFont(Font)]|{excerpt-include:TableCell.ApplyFont(Font)|nopanel=true}|
|[ApplyParagraphFormatting(ParagraphFormatting)|TableCell.ApplyParagraphFormatting(ParagraphFormatting)]|{excerpt-include:TableCell.ApplyParagraphFormatting(ParagraphFormatting)|nopanel=true}|
|[GetBorder(Border.Location)|TableCell.GetBorder(Border.Location)]|{excerpt-include:TableCell.GetBorder(Border.Location)|nopanel=true}|
|[GetPadding(TableCell.Location)|TableCell.GetPadding(TableCell.Location)]|{excerpt-include:TableCell.GetPadding(TableCell.Location)|nopanel=true}|
|[SetPadding(TableCell.Location, Int32)|TableCell.SetPadding(TableCell.Location, Int32)]|{excerpt-include:TableCell.SetPadding(TableCell.Location, Int32)|nopanel=true}|
{classes}
||Name||Description||
|[Location|TableCell.Location]|{excerpt-include:TableCell.Location|nopanel=true}|
|[VerticalAlignment|TableCell.VerticalAlignment]|{excerpt-include:TableCell.VerticalAlignment|nopanel=true}|
|[WidthUnits|TableCell.WidthUnits]|{excerpt-include:TableCell.WidthUnits|nopanel=true}|