Reading Page Setup Information from MPP File
Contents
[
Hide
Show
]Aspose.Tasks for Java API provides the capability to read the Header and Footer information from MPP file. The API has classes mapped to each tab of Microsoft Project Page Setup dialog as detailed in the section below.
Reading Page Setup Information from MPP File
Microsoft Project Page Setup dialog box has 6 tabs (see screenshot). These tabs are mapped to new classes:
- Page tab -> Aspose.Tasks.Visualization.PageSettings class
- Margins tab -> Aspose.Tasks.Visualization.PageMargins class
- Header, footer tabs -> Aspose.Tasks.Visualization.HeaderFooterInfo class
- Legend tab -> Aspose.Tasks.Visualization.PageLegend class
- View tab -> Aspose.Tasks.Visualization.PageViewSettings class
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(ReadPageSetupInformation.class);
4
5Project project = new Project(dataDir + "HeaderFooter2007_3.mpp"); // Attached
6// test
7// project
8PageInfo info = project.getDefaultView().getPageInfo();
9
10// Header Footer information
11System.out.println(info.getHeader().getLeftText());
12System.out.println(info.getHeader().getCenteredText());
13System.out.println(info.getHeader().getRightText());
14System.out.println(info.getFooter().getLeftText());
15System.out.println(info.getFooter().getCenteredText());
16System.out.println(info.getFooter().getRightText());
17
18// Page Settings information
19System.out.println(info.getPageSettings().isPortrait());
20System.out.println(info.getPageSettings().getAdjustToPercentOfNormalSize());
21System.out.println(info.getPageSettings().getPercentOfNormalSize());
22System.out.println(info.getPageSettings().getPagesInWidth());
23System.out.println(info.getPageSettings().getPagesInHeight());
24System.out.println(info.getPageSettings().getPaperSize());
25
26// Page View Settings
27System.out.println(info.getPageViewSettings().getPrintAllSheetColumns());
28System.out.println(info.getPageViewSettings().getPrintFirstColumnsCountOnAllPages());
29System.out.println(info.getPageViewSettings().getFirstColumnsCount());
30System.out.println(info.getPageViewSettings().getPrintNotes());
31System.out.println(info.getPageViewSettings().getPrintBlankPages());
32System.out.println(info.getPageViewSettings().getFitTimescaleToEndOfPage());
33
34// Page Margins
35System.out.println(info.getMargins().getLeft());
36System.out.println(info.getMargins().getTop());
37System.out.println(info.getMargins().getRight());
38System.out.println(info.getMargins().getBottom());
39System.out.println(info.getMargins().getBorders());
40
41// Page Legend
42System.out.println(info.getLegend().getLeftText());
43System.out.println(info.getLegend().getCenteredText());
44System.out.println(info.getLegend().getRightText());
45System.out.println(info.getLegend().getLegendOn());
46System.out.println(info.getLegend().getWidth());