GetDefaultFieldTitle

FieldHelper.GetDefaultFieldTitle method

Returns a default title of the specific field.

public static string GetDefaultFieldTitle(Field field)
ParameterTypeDescription
fieldFieldField to get a default title.

Return Value

A default title of the specific field if the field can be displayed in MS Project’s view, null otherwise.

Examples

Shows how to use <see cref=“Aspose.Tasks.Saving.CsvOptions” /> to take the columns of the default Gantt Chart and

// save them to a CSV file.
var project = new Project(DataDir + "EstimatedMilestoneTasks.mpp");

CsvOptions options = new CsvOptions();
options.TextDelimiter = CsvTextDelimiter.Tab;

var view = project.DefaultView;
options.View = ProjectView.GetDefaultGanttChartView();
options.View.Columns.Clear();

foreach (var t in view.Table.TableFields)
{
    var columnTitle = string.IsNullOrEmpty(t.Title) ? FieldHelper.GetDefaultFieldTitle(t.Field) : t.Title;
    options.View.Columns.Add(new GanttChartColumn(columnTitle, 10, t.Field));
}

project.Save(OutDir + "CustomizeViewForCsvOptions_out.csv", options);

See Also