GanttChartColumn Class

Project's view class
Inheritance Hierarchy

Namespace:  Aspose.Tasks.Visualization
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.5
Syntax
public sealed class GanttChartColumn : ViewColumn

The GanttChartColumn type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleGanttChartColumn(Int32, Field)
Initializes a new instance of the GanttChartColumn class.
Public methodCode exampleGanttChartColumn(String, Int32, Field)
Initializes a new instance of the GanttChartColumn class.
Public methodCode exampleGanttChartColumn(String, Int32, TaskToColumnTextConverter)
Initializes a new instance of the GanttChartColumn class.
Public methodCode exampleGanttChartColumn(String, Int32, TaskToColumnTextConverter, Field)
Initializes a new instance of the GanttChartColumn class.
Properties
  NameDescription
Public propertyCode exampleField
Column field. Field.
(Overrides ViewColumnField.)
Public propertyCode exampleName
Gets the column name.
(Inherited from ViewColumn.)
Public propertyCode exampleStringAlignment
Gets or sets alignment of the text (can be one of the values of the StringAlignment enumeration).
(Inherited from ViewColumn.)
Public propertyCode exampleTextStyleModificationCallback
Gets or sets the callback which can be used to customize the appearance of the column's cells.
(Inherited from ViewColumn.)
Public propertyCode exampleWidth
Gets the column width.
(Inherited from ViewColumn.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodCode exampleGetColumnText
Converts current task to the column text.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to add Gantt chart view columns to be exported.
var project = new Project(DataDir + "Project2.mpp");
var task = project.RootTask.Children.GetById(1);

var columns = new List<ViewColumn>
{
    new GanttChartColumn(20, Field.TaskUniqueID),
    new GanttChartColumn("Name", 150, Field.TaskName),
    new GanttChartColumn("Start", 100, Field.TaskStart),
    new GanttChartColumn("End", 100, Field.TaskFinish),
    new GanttChartColumn("R-Initials", 100, Field.TaskResourceInitials),
    new GanttChartColumn("R-Names", 100, Field.TaskResourceNames),
    new GanttChartColumn("Work", 50, Field.TaskWork),
    new GanttChartColumn(
        "Cost", 
        80,
        delegate(Task t)
        {
            return t.Get(Tsk.Cost).ToString(CultureInfo.InvariantCulture);
        }),
    new GanttChartColumn(
        "Actual Cost", 
        80,
        delegate(Task t)
        {
            return t.Get(Tsk.ActualCost).ToString(CultureInfo.InvariantCulture);
        },
        Field.TaskActualCost)
};

// iterate over columns
foreach (var column in columns)
{
    var col = (GanttChartColumn)column;
    Console.WriteLine("Column Name: " + col.Name);
    Console.WriteLine("Column Field: " + col.Field);
    Console.WriteLine("Column Text: " + col.GetColumnText(task));
    Console.WriteLine();
}

var options = new CsvOptions
{
    View = new ProjectView(columns),
    PresentationFormat = PresentationFormat.GanttChart
};

project.Save(OutDir + "WorkWithGanttChartColumn_out.csv", options);
See Also