public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:AlignCellContents //ExFor: ViewColumn.StringAlignment //ExSummary: Shows how to set a alignment of the text in a column (can be one of the values of the <see cref="P:Aspose.Tasks.Visualization.ViewColumn.StringAlignment" /> enumeration). Project project = new Project(dataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions(); options.Timescale = Timescale.Months; options.View = ProjectView.GetDefaultGanttChartView(); GanttChartColumn column1 = (GanttChartColumn)options.View.Columns[2]; column1.StringAlignment = StringAlignment.Center; var column2 = (GanttChartColumn)options.View.Columns[3]; column2.StringAlignment = StringAlignment.Far; var column3 = (GanttChartColumn)options.View.Columns[4]; column3.StringAlignment = StringAlignment.Far; project.Save(dataDir + "AlignCellContents_GanttChart_out.pdf", options); options.PresentationFormat = PresentationFormat.ResourceSheet; options.View = ProjectView.GetDefaultResourceSheetView(); ResourceViewColumn column4 = (ResourceViewColumn)options.View.Columns[2]; column4.StringAlignment = StringAlignment.Center; var column5 = (ResourceViewColumn)options.View.Columns[3]; column5.StringAlignment = StringAlignment.Far; var column6 = (ResourceViewColumn)options.View.Columns[4]; column6.StringAlignment = StringAlignment.Far; project.Save(dataDir + "AlignCellContents_ResourceSheet_out.pdf", options); //ExEnd:AlignCellContents }
public void AlignCellContents() { // ExStart:AlignCellContents // ExFor: ViewColumn.StringAlignment // ExSummary: Shows how to set a alignment of the text in a column (can be one of the values of the <see cref="P:Aspose.Tasks.Visualization.ViewColumn.StringAlignment" /> enumeration). var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions(); options.Timescale = Timescale.Months; options.View = ProjectView.GetDefaultGanttChartView(); var column1 = (GanttChartColumn)options.View.Columns[2]; column1.StringAlignment = StringAlignment.Center; var column2 = (GanttChartColumn)options.View.Columns[3]; column2.StringAlignment = StringAlignment.Far; var column3 = (GanttChartColumn)options.View.Columns[4]; column3.StringAlignment = StringAlignment.Far; project.Save(OutDir + "AlignCellContents_GanttChart_out.pdf", options); options.PresentationFormat = PresentationFormat.ResourceSheet; options.View = ProjectView.GetDefaultResourceSheetView(); var column4 = (ResourceViewColumn)options.View.Columns[2]; column4.StringAlignment = StringAlignment.Center; var column5 = (ResourceViewColumn)options.View.Columns[3]; column5.StringAlignment = StringAlignment.Far; var column6 = (ResourceViewColumn)options.View.Columns[4]; column6.StringAlignment = StringAlignment.Far; project.Save(OutDir + "AlignCellContents_ResourceSheet_out.pdf", options); // ExEnd:AlignCellContents }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // ExStart:AlignCellContents Project project = new Project(dataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions(); options.Timescale = Timescale.Months; options.View = ProjectView.GetDefaultGanttChartView(); GanttChartColumn column1 = options.View.Columns[2] as GanttChartColumn; column1.StringAlignment = StringAlignment.Center; column1 = options.View.Columns[3] as GanttChartColumn; column1.StringAlignment = StringAlignment.Far; column1 = options.View.Columns[4] as GanttChartColumn; column1.StringAlignment = StringAlignment.Far; project.Save(dataDir + "AlignCellContents_GanttChart_out.pdf", options); options.PresentationFormat = PresentationFormat.ResourceSheet; options.View = ProjectView.GetDefaultResourceSheetView(); ResourceViewColumn column2 = options.View.Columns[2] as ResourceViewColumn; column2.StringAlignment = StringAlignment.Center; column2 = options.View.Columns[3] as ResourceViewColumn; column2.StringAlignment = StringAlignment.Far; column2 = options.View.Columns[4] as ResourceViewColumn; column2.StringAlignment = StringAlignment.Far; project.Save(dataDir + "AlignCellContents_ResourceSheet_out.pdf", options); // ExEnd:AlignCellContents }
public void WorkWithProjectView() { { // ExStart // ExFor: ProjectView // ExFor: ProjectView.GetDefaultAssignmentView // ExSummary: Shows how to save a project with assignment view. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions { Timescale = Timescale.Months, View = ProjectView.GetDefaultAssignmentView() }; project.Save(OutDir + "WorkWithProjectView_AssignmentView_out.pdf", options); // ExEnd } { // ExStart // ExFor: ProjectView.GetDefaultGanttChartView // ExSummary: Shows how to save a project with Gantt chart view. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions { Timescale = Timescale.Months, View = ProjectView.GetDefaultGanttChartView() }; project.Save(OutDir + "WorkWithProjectView_GanttChartView_out.pdf", options); // ExEnd } { // ExStart // ExFor: ProjectView.GetDefaultResourceSheetView // ExSummary: Shows how to save a project with resource sheet view. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions { Timescale = Timescale.Months, View = ProjectView.GetDefaultResourceSheetView() }; project.Save(OutDir + "WorkWithProjectView_ResourceSheetView_out.pdf", options); // ExEnd } { // ExStart // ExFor: ProjectView.GetDefaultResourceUsageView // ExSummary: Shows how to save a project with resource usage view. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions { Timescale = Timescale.Months, View = ProjectView.GetDefaultResourceUsageView() }; project.Save(OutDir + "WorkWithProjectView_ResourceUsageView_out.pdf", options); // ExEnd } { // ExStart // ExFor: ProjectView.GetDefaultTaskSheetView // ExSummary: Shows how to save a project with task sheet view. var project = new Project(DataDir + "Project2.mpp"); SaveOptions options = new PdfSaveOptions { Timescale = Timescale.Months, View = ProjectView.GetDefaultTaskSheetView() }; project.Save(OutDir + "WorkWithProjectView_TaskSheetView_out.pdf", options); // ExEnd } { // ExStart // ExFor: ProjectView.#ctor(System.Collections.Generic.IEnumerable{Aspose.Tasks.Visualization.ViewColumn}) // ExFor: ProjectView.Columns // ExSummary: Shows how to save a project with a view with custom set of columns. var project = new Project(DataDir + "Project2.mpp"); var options = new PdfSaveOptions(); var columns = new List <ViewColumn> { new GanttChartColumn("Name", 100, Field.TaskName), new GanttChartColumn("Start", 100, Field.TaskStart), new GanttChartColumn("Finish", 100, Field.TaskFinish), new GanttChartColumn("Cost2", 80, Field.TaskCost2), new GanttChartColumn("Number6", 80, Field.TaskNumber6), new GanttChartColumn("Date6", 80, Field.TaskDate6), new GanttChartColumn("Flag6", 80, Field.TaskFlag6), new GanttChartColumn("Flag18", 80, Field.TaskFlag18), new GanttChartColumn("Duration6", 80, Field.TaskDuration6) }; options.View = new ProjectView(columns); // iterate over view columns foreach (var column in options.View.Columns) { Console.WriteLine("Column Name: " + column.Name); } options.PresentationFormat = PresentationFormat.TaskUsage; project.Save(OutDir + "TaskUsageProjectView_Columns.pdf", options); // ExEnd } }