프로젝트 페이지로 작업합니다

Aspose.Tasks for java는 프로젝트에서 총 페이지 수를 검색 할 수 있습니다. Aspose.Tasks 의 시각화 네임 스페이스가 제공하는 getPageCount 메소드는 TimesCale.Days, TimesCale.Months 또는 TimesCale.thirdsofmonths를 기반으로 렌더링하는 옵션으로 프로젝트에서 총 페이지 수를 반환합니다.

프로젝트에서 페이지 수 받기

Project 클래스는 프로젝트에서 총 페이지 수를 얻는 데 사용되는 getPageCount 메소드를 노출시킵니다. 프로젝트의 총 페이지 수는 TimesCale.days, TimesCale.Months 또는 TimesCale.thoflofmonths에 대해 검색 할 수 있습니다.

PDF에 프로젝트를 저장하려면 :

  1. Microsoft 프로젝트 파일을로드하십시오.
  2. 옵션 타임 스케일 설정과 함께 getPageCount 메소드를 사용하여 프로젝트의 총 페이지 수를 가져옵니다.

프로그래밍 샘플 : 프로젝트에서 페이지 수 받기 다음 줄의 코드는 Java를 사용하여이를 달성하는 방법을 보여줍니다.

1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2Project project = new Project(projectName);
3// Get number of pages
4int iPages = project.getPageCount();
5// Get number of pages (Timescale.Months)
6iPages = project.getPageCount(0, Timescale.Months);
7// Get number of pages (Timescale.ThirdsOfMonths)
8iPages = project.getPageCount(0, Timescale.ThirdsOfMonths);

Programming Sample: Get Number of Pages for Different Views Aspose.Tasks for Java supports rendering a project’s resource usage, resource sheet and task usage to PDF format, and enables users to get the number of pages in the rendered output for these views. This programming sample demonstrates rendering a projects’ usage view and getting the number of pages in the rendered output.

 1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
 2// Read the source Project
 3Project project = new Project(projectName);
 4// Get number of pages
 5System.out
 6        .println("Number of Pages = " + project.getPageCount(PresentationFormat.ResourceUsage, Timescale.Days));
 7// Get number of pages (Months)
 8System.out.println(
 9        "Number of Pages = " + project.getPageCount(PresentationFormat.ResourceUsage, Timescale.Months));
10// Get number of pages (ThirdsOfMonths)
11System.out.println("Number of Pages = "
12        + project.getPageCount(PresentationFormat.ResourceUsage, Timescale.ThirdsOfMonths));

Programming Sample: Get number of pages based on Start and End Dates

 1Project project = new Project(projectName);
 2
 3Date dtStartDate, dtEndDate;
 4java.util.Calendar cal = java.util.Calendar.getInstance();
 5cal.setTime(project.get(Prj.START_DATE));
 6cal.add(java.util.Calendar.DAY_OF_MONTH, 7);    //add 7 days from start of project
 7dtStartDate = cal.getTime();
 8        
 9//Get Finish date with 30 days offset
10cal.setTime(project.get(Prj.FINISH_DATE));
11cal.add(java.util.Calendar.DAY_OF_MONTH, -30);
12dtEndDate = cal.getTime();
13        
14ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
15{
16    options.setSaveToSeparateFiles(true);
17    options.setPageSize(PageSize.A3);
18    options.setTimescale(Timescale.Months);
19    options.setStartDate (dtStartDate);
20    options.setEndDate(dtEndDate);
21};
22        
23int pageCount = project.getPageCount_PageSize(
24    PageSize.A3,
25    Timescale.Months,
26    dtStartDate,
27    dtEndDate);
28
29System.out.println("Number of Pages = " + pageCount);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.