Aspose.Tasks.Examples.CSharp.WorkingWithProjects.AddImageToPageHeaderFooter.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

                // ExStart:AddImageToPageHeaderFooter
                Project project = new Project(dataDir + "AddImageToPageHeaderFooter.mpp");

                project.RootTask.Children.Add("Task1");
                PageInfo pageInfo = project.DefaultView.PageInfo;
                
                using (Image image = Image.FromFile(dataDir + "Image1.png"))
                {
                    pageInfo.Header.CenteredImage = image;
                    pageInfo.Legend.LeftImage = image;
                    pageInfo.Legend.LeftText = string.Empty;
                    MPPSaveOptions saveOptions = new MPPSaveOptions();
                    saveOptions.WriteViewData = true;
                    project.Save(dataDir + "AddImageToPageHeaderFooter_out.mpp", saveOptions);
                }
                // ExEnd:AddImageToPageHeaderFooter
            }
            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.");
            }
        }
    }
AddImageToPageHeaderFooter