AssignmentViewColumn

AssignmentViewColumn class

Project’s view class.

public class AssignmentViewColumn : ViewColumn

Constructors

NameDescription
AssignmentViewColumn(string, int, AssignmentToColumnTextConverter)Initializes a new instance of the AssignmentViewColumn class.

Properties

NameDescription
override Field { get; set; }Column field. Field.
Name { get; }Gets the column name.
StringAlignment { get; set; }Gets or sets alignment of the text (can be one of the values of the HorizontalStringAlignment enumeration).
TextStyleModificationCallback { get; set; }Gets or sets the callback which can be used to customize the appearance of the column’s cells.
Width { get; }Gets the column width.

Methods

NameDescription
GetColumnText(ResourceAssignment)Converts current resource assignment to the column text.

Examples

Shows how to add columns for assignment views.

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

var options = new Spreadsheet2003SaveOptions();

var column = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return assignment.Get(Asn.NotesText); });
options.AssignmentView.Columns.Add(column);

foreach (var assignment in project.ResourceAssignments)
{
    foreach (var col in options.AssignmentView.Columns)
    {
        var assnCol = (AssignmentViewColumn)col;
        Console.WriteLine("Column Field: " + assnCol.Field);
        Console.WriteLine("Column Text ( converted ): " + assnCol.GetColumnText(assignment));
        Console.WriteLine();
    }
}

project.Save(OutDir + "UsingSpreadsheet2003SaveOptions_out.xml", options);

See Also