Class CsvOptions

CsvOptions class

Allows to specify additional options when saving project to CSV.

public class CsvOptions : SimpleSaveOptions

Constructors

NameDescription
CsvOptions()Initializes a new instance of the CsvOptions class which can be used to save project in CSV format.

Properties

NameDescription
DataCategory { get; set; }Gets or sets a data category to be saved.
Encoding { get; set; }Gets or sets an encoding to save CSV with.
IncludeHeaders { get; set; }Gets or sets a value indicating whether to include headers or not (default value is TRUE).
SaveFormat { get; }Gets or sets the format in which the document will be saved if this save options object is used.
TasksComparer { get; set; }Gets or sets the comparer to sort tasks on Gantt chart and Task Sheet chart.
TasksFilter { get; set; }Gets or sets the condition which is used to filter tasks rendered on Gantt, Task Sheet and Task Usage charts.
TextDelimiter { get; set; }Gets or sets a text delimiter.
View { get; set; }Gets or sets a list of the view columns (GanttChartColumn) to save to XLSX format. If not set then default columns are saved.

Examples

Shows how to use <see cref=“Aspose.Tasks.Saving.CsvOptions” /> to save a project as CSV file.

var project = new Project(DataDir + "EstimatedMilestoneTasks.mpp");
var options = new CsvOptions
{
    DataCategory = DataCategory.Resources,
    TextDelimiter = CsvTextDelimiter.Semicolon,
    Encoding = Encoding.Unicode, IncludeHeaders = true
};

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

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