public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); // Read the input Project file Project project = new Project(dataDir + "CreateProject2.mpp"); // ExStart:UsingSpreadsheet2003SaveOptions Spreadsheet2003SaveOptions options = new Spreadsheet2003SaveOptions(); GanttChartColumn col = new GanttChartColumn("WBS", 100, delegate(Task task) { return task.Get(Tsk.WBS); }); options.View.Columns.Add(col); ResourceViewColumn rscCol = new ResourceViewColumn("Cost center", 100, delegate(Resource resource) { return resource.Get(Rsc.CostCenter); }); options.ResourceView.Columns.Add(rscCol); AssignmentViewColumn assnCol = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return assignment.Get(Asn.Notes); }); options.AssignmentView.Columns.Add(assnCol); project.Save(dataDir + "UsingSpreadsheet2003SaveOptions_out.xml", options); // ExEnd:UsingSpreadsheet2003SaveOptions }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); //ExStart:UsingXlsxOptions // Read the input Project file Project project = new Project(dataDir + "CreateProject2.mpp"); XlsxOptions options = new XlsxOptions(); // Add desired Gantt Chart columns GanttChartColumn col = new GanttChartColumn("WBS", 100, delegate(Task task) { return(task.Get(Tsk.WBS)); }); options.View.Columns.Add(col); // Add desired resource view columns ResourceViewColumn rscCol = new ResourceViewColumn( "Cost center", 100, delegate(Resource resource) { return(resource.Get(Rsc.CostCenter)); }); options.ResourceView.Columns.Add(rscCol); // Add desired assignment view columns AssignmentViewColumn assnCol = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return(assignment.Get(Asn.Notes)); }); options.AssignmentView.Columns.Add(assnCol); project.Save(dataDir + "UsingXlsxOptions_out.xlsx", options); //ExEnd:UsingXlsxOptions }
public void UsingSpreadsheet2003SaveOptions() { // ExStart:UsingSpreadsheet2003SaveOptions // ExFor: Spreadsheet2003SaveOptions // ExFor: Spreadsheet2003SaveOptions.#ctor // ExFor: Spreadsheet2003SaveOptions.ResourceView // ExFor: Spreadsheet2003SaveOptions.AssignmentView // ExSummary: Shows how to add columns to be exported during export project into Spreadsheet2003 format. var project = new Project(DataDir + "CreateProject2.mpp"); var options = new Spreadsheet2003SaveOptions(); var ganttChartColumn = new GanttChartColumn("WBS", 100, delegate(Task task) { return(task.Get(Tsk.WBS)); }); options.View.Columns.Add(ganttChartColumn); var resourceViewColumn = new ResourceViewColumn("Cost center", 100, delegate(Resource resource) { return(resource.Get(Rsc.CostCenter)); }); options.ResourceView.Columns.Add(resourceViewColumn); var assignmentViewColumn = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return(assignment.Get(Asn.Notes)); }); options.AssignmentView.Columns.Add(assignmentViewColumn); project.Save(OutDir + "UsingSpreadsheet2003SaveOptions_out.xml", options); // ExEnd:UsingSpreadsheet2003SaveOptions }
public void WorkWithXlsxOptions() { // ExStart:UsingXlsxOptions // ExFor: XlsxOptions // ExFor: XlsxOptions.#ctor // ExFor: XlsxOptions.AssignmentView // ExFor: XlsxOptions.ResourceView // ExFor: XlsxOptions.Encoding // ExSummary: Shows how to save a project into XLSX file by using <see cref="P:Aspose.Tasks.Saving.XlsxOptions">Days</see> options. var project = new Project(DataDir + "CreateProject2.mpp"); var options = new XlsxOptions(); // Add desired Gantt Chart columns var col = new GanttChartColumn("WBS", 100, delegate(Task task) { return(task.Get(Tsk.WBS)); }); options.View.Columns.Add(col); // Add desired resource view columns var rscCol = new ResourceViewColumn("Cost center", 100, delegate(Resource resource) { return(resource.Get(Rsc.CostCenter)); }); options.ResourceView.Columns.Add(rscCol); // Add desired assignment view columns var assnCol = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return(assignment.Get(Asn.Notes)); }); options.AssignmentView.Columns.Add(assnCol); // set encoding options.Encoding = Encoding.Unicode; project.Save(OutDir + "UsingXlsxOptions_out.xlsx", options); // ExEnd:UsingXlsxOptions }
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 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 }