SaveOptionsViewSettings Property

Gets or sets a view (View) to render. You can use this options to explicitly specify which view should be saved to PDF, HTML or Image formats. If this property is set, PresentationFormat property is ignored when project is saved. View should be from one of the following screen ((Screen)): (Gantt, TaskSheet, TaskUsage, ResourceSheet, ResourceUsage)

Namespace:  Aspose.Tasks.Saving
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.6
public View ViewSettings { get; set; }

Property Value

Type: View
ArgumentExceptionWhen set method is called and instance of View class with not supported value of Screen property is provided.
Shows how to use 'SaveOptions.ViewSettings' to specify view that should be rendered to PDf.
var project = new Project(DataDir + "EstimatedMilestoneTasks.mpp");

var view = project.Views.First(v => v.Screen == ViewScreen.Gantt);
Console.WriteLine("Page size specified in view settings: " + view.PageInfo.PageSettings.PaperSize);
Console.WriteLine("Page orientation: {0}", view.PageInfo.PageSettings.IsPortrait ? "Portrait" : "Landscape");

PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.PageSize = PageSize.DefinedInView;
saveOptions.Timescale = Timescale.DefinedInView;
saveOptions.StartDate = new DateTime(2012, 12, 22);
saveOptions.EndDate = new DateTime(2013, 05, 10);
saveOptions.ViewSettings = view;

project.Save(OutDir + "SaveToPdfUsingSpecificView_out.pdf", saveOptions);
See Also