Table

Table class

Represents a table in Project

public class Table

Constructors

NameDescription
Table()Initializes a new instance of the Table class.

Properties

NameDescription
AdjustHeaderRowHeight { get; set; }Gets or sets a value indicating whether the header row height of the table can be adjusted.
DateFormat { get; set; }Gets or sets the date format of the table.
Index { get; }Gets the index of a Table object in the Tables containing object.
LockFirstColumn { get; set; }Gets or sets a value indicating whether the first column of a table is locked or editable.
Name { get; set; }Gets or sets the name of a Table object.
RowHeight { get; set; }Gets or sets the row height in a table, where the row height is the number of lines of text.
ShowAddNewColumn { get; set; }Gets or sets a value indicating whether to show ‘Add New Column’ interface. Supported by MSP 2010 version and later.
ShowInMenu { get; set; }Gets or sets a value indicating whether project shows the table name in the Tables drop-down list on the View tab of the Ribbon.
TableFields { get; }Gets a TableFields collection representing the fields in the table.
TableType { get; }Gets the table type for the specified table. Read-only ItemType.
Uid { get; }Gets the unique identifier of a table.

Methods

NameDescription
override Equals(object)Returns a value indicating whether this instance is equal to a specified object.
override GetHashCode()Returns a hash code for this Table.

Examples

Shows how to define a new table (using for views).

var project = new Project(DataDir + "Project1.mpp");

// get a table to edit
var table = project.Tables.ToList()[0];
Console.WriteLine("Uid of the table: " + table.Uid);
Console.WriteLine("Index of the table: " + table.Index);
Console.WriteLine("Name of the table: " + table.Name);
Console.WriteLine("Type of the table: " + table.TableType);

// tune some properties
// set a value indicating whether the header row height of the table can be adjusted
table.AdjustHeaderRowHeight = true;

// set the date format of the table.
table.DateFormat = DateFormat.DateDdMmYyyy;

// set a value indicating whether the first column of a table is locked or editable
table.LockFirstColumn = true;

// set the row height in a table, where the row height is the number of lines of text
table.RowHeight = 10;

// sets a value indicating whether to show 'Add New Column' interface
table.ShowAddNewColumn = true;

// set a value indicating whether project shows the table name in the Tables drop-down list on the View tab of the Ribbon
table.ShowInMenu = true;

// lets save the updated table
project.Save(OutDir + "WorkWithTable_out.mpp", SaveFileFormat.Mpp);

See Also