Aspose.Tasks.Examples.CSharp.WorkingWithProjects.WorkingWithProjectViews.ConfigureTheGantChartViewShowSelectedColumnFields.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {            
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

                // ExStart:ConfigureTheGantChartViewShowSelectedColumnFields
                Project project = new Project(dataDir + "Project5.mpp"); 
                
                // Create a new project task
                Task task = project.RootTask.Children.Add("New Activity");

                // Add custom text attribute to created task.
                ExtendedAttribute attr = new ExtendedAttribute();
                attr.FieldId = ((int)ExtendedAttributeTask.Text1).ToString();
                attr.Value = "Activity attribute";
                task.ExtendedAttributes.Add(attr);

                // Customize table by adding text attribute field
                TableField attrField = new TableField();
                attrField.Field = Field.TaskText1;
                attrField.Width = 20;
                attrField.Title = "Custom attribute";
                attrField.AlignTitle = StringAlignment.Center;
                attrField.AlignData = StringAlignment.Center;
                Table table = project.Tables.ToList()[0];
                table.TableFields.Insert(3, attrField);

                // Save project as MPP
                project.Save(dataDir + "ConfigureTheGantChartViewShowSelectedColumnFields_out.mpp", SaveFileFormat.MPP);
                // ExEnd:ConfigureTheGantChartViewShowSelectedColumnFields
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }
        }
    }
ConfigureTheGantChartViewShowSelectedColumnFields