|
Programmer's Reference >
WordApplication API >
TableCell
The TableCell Object
Represents a table cell in a table in the Word document. New table cells are created when you create a new Table. They cannot be created independent of a Table using the new keyword. To retrieve and manipulate a table cell, use the getCell(int, int) method of the Table class. You can also use Element.Elements(Element.Type.TableCell) to get all elements, of which you can check which ones are of type TableCell. The following sample demonstrates getting a reference to a table cell at column 3 (4nd column), row 2 (3rd row).
Examples:
[csharp]
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
SoftArtisans.OfficeWriter.WordWriter.Table table =
(SoftArtisans.OfficeWriter.WordWriter.Table)doc.get_Elements(Element.Type.Table)[0];
TableCell cell = table.Cell(3, 2);
[vbnet]
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim table As SoftArtisans.OfficeWriter.WordWriter.Table = doc.Elements(Element.Type.Table)(0)
Dim cell As TableCell = table.Cell(3, 2)
Please note that this object inherits methods and properties not shown here from the following objects:
TableCell Enumerations
TableCell Properties
| Property |
Type |
Access |
Description |
| Border |
Border
|
read |
Returns an Border object that lets you manipulate the border this table cell at a particular location
|
| CellWidthUnits |
TableCell.WidthUnits
|
read write |
Sets or returns a TableCell.WidthUnits object that represents the cell width units for this cell.
MS Word equivalent: Table menu > Table Properties..
|
| FirstMerged |
boolean
|
read write |
Returns or sets a boolean that represents if this is the first cell in a group of horizontally merged cells
|
| FirstVerticalMerged |
boolean
|
read write |
Sets or returns whether the current cell is the first cell in a group of vertically merged cells
|
| Merged |
boolean
|
read write |
Sets or returns whether this cell has been merged with a preceding horizontal cell.
|
| NoWrap |
boolean
|
read write |
Returns or sets a boolean that represents if Word will prevent text from wrapping in this table cell
|
| Padding |
int
|
read write |
Returns or sets an int that represents this table cell margin at a particular location in twips
|
| PreferredWidth |
int
|
read write |
Returns or sets an int that represents the preferred width of this cell in twips
|
| Shading |
Shading
|
read |
Returns an Shading object which on which you can manipulate the shading (fill color and/or pattern) properties for this cell
|
| VertAlignment |
TableCell.VerticalAlignment
|
read write |
Returns or sets a TableCell.VerticalAlignment object that represents the vertical alignment of the text in this cell
|
| VerticalMerged |
boolean
|
read write |
Returns or sets a boolean that represents if this cell is merged with one or more cells vertically
|
TableCell Methods

Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.
|