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
        }
示例#2
0
        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 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
        }
示例#4
0
        public void WorkWithAssignmentViewColumn()
        {
            // ExStart
            // ExFor: AssignmentViewColumn
            // ExFor: AssignmentViewColumn.#ctor(String,Int32,AssignmentToColumnTextConverter)
            // ExFor: AssignmentViewColumn.Field
            // ExFor: AssignmentViewColumn.GetColumnText(ResourceAssignment)
            // ExFor: AssignmentToColumnTextConverter
            // ExSummary: Shows how to add columns for assignment views.
            var project = new Project(DataDir + "CreateProject2.mpp");

            var options = new Spreadsheet2003SaveOptions();

            var column = new AssignmentViewColumn("Notes", 200, delegate(ResourceAssignment assignment) { return(assignment.Get(Asn.Notes)); });

            options.AssignmentView.Columns.Add(column);

            foreach (var assignment in project.ResourceAssignments)
            {
                foreach (var col in options.AssignmentView.Columns)
                {
                    var assnCol = (AssignmentViewColumn)col;
                    Console.WriteLine("Column Field: " + assnCol.Field);
                    Console.WriteLine("Column Text ( converted ): " + assnCol.GetColumnText(assignment));
                    Console.WriteLine();
                }
            }

            project.Save(OutDir + "UsingSpreadsheet2003SaveOptions_out.xml", options);

            // ExEnd
        }