Printing MS Project MPP files to Separate Image Files

To print a Project’s pages to separate output files, use the ImageSaveOptions.SaveToSeparateFiles property. It specifies whether to save pages to separate files or not. Also, the API provides the ImageSaveOptions.Pages property that contains a list of page numbers to save when saving project layouts to separate files. All pages are saved if this list is empty and ImageSaveOptions.SaveToSeparateFiles is set to true.

Printing Project Pages to Separate Files

The following code example demonstrates how to print individual pages in a project to separate files.

 1Project project = new Project("New Project.mpp");
 2ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
 3options.StartDate = project.Get(Prj.StartDate).AddDays(-3);
 4options.EndDate = project.Get(Prj.FinishDate);
 5
 6options.MarkCriticalTasks = true;
 7options.LegendOnEachPage = false;
 8
 9options.Gridlines = new List<Gridline>();
10
11Gridline gridline = new Gridline();
12gridline.GridlineType = GridlineType.GanttRow;
13gridline.Color = Color.CornflowerBlue;
14gridline.Pattern = LinePattern.Dashed;
15options.Gridlines.Add(gridline);
16 
17// Save the whole project layout to one file
18project.Save("PrintProjectPagesToSeparateFiles1_out.png", (SaveOptions)options);
19
20// Save project layout to separate files
21options.SaveToSeparateFiles = true;
22project.Save("PrintProjectPagesToSeparateFiles2_out.png", (SaveOptions)options);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.