작업 사용보기 렌더링
Contents
[
Hide
Show
]Aspose.Tasks for Java는 PDF와 같은 다양한 형식으로 프로젝트 작업을 렌더링하는 것을 지원합니다. 작업 사용량은 Days, 3overths 및 Months 및 Months와 같은 다른 시간 확장 설정을 사용하여 Aspose.Tasks 의 프레젠테이션 형식을 사용하여 렌더링 할 수 있습니다.
작업 사용보기 렌더링
이 기사의 코드 스 니펫은 자원이 할당 된 여러 작업이있는 소스 MPP 파일을 읽고 다음 단계를 사용하여 PDF를 출력하도록합니다.
- 프로젝트 리더 인스턴스를 만듭니다.
- 소스 MPP 파일을 읽으십시오.
- 필요한 시간 스케일 설정으로 SaveOptions 객체를 시작하십시오.
- 프레젠테이션 형식을 TaskUsage로 설정하십시오.
- 프로젝트를 PDF 출력으로 렌더링하십시오.
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(RenderTaskUsage.class);
4//Read the source Project
5Project project = new Project(dataDir + "RenderMe.mpp");
6//Define the SaveOptions with required TimeScale settings as Days
7SaveOptions options = new PdfSaveOptions();
8options.setTimescale(Timescale.Days);
9//Set the Presentation format to ResourceUsage
10options.setPresentationFormat(PresentationFormat.TaskUsage);
11String days = "result_days.pdf";
12//Save the Project
13project.save(days, options);
14
15//Set the Tiemscale settings to ThirdsOfMonths
16options.setTimescale(Timescale.ThirdsOfMonths);
17String thirds = "result_thirdsOfMonths.pdf";
18//Save the Project
19project.save(thirds, options);
20
21//Set the Timescale settings to Months
22options.setTimescale(Timescale.Months);
23String months = "result_months.pdf";
24//Save the project
25project.save(months, options);
Rendering Details Column to Output in Task Usage View
The details column included in the MPP file can be rendered to the output using the View’s DisplayDetailsHeaderColumn property. The following code sample illustrates the usage of this property.
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(RenderTaskUsage.class);
4Project project = new Project(dataDir + "Advanced Tracking C_Start.mpp"); // attached test project
5// Default view in this mpp is TaskUsageView
6UsageView view = (UsageView) project.getDefaultView();// as TaskUsageView;
7
8// details header column will not be displayed
9view.setDisplayDetailsHeaderColumn(false);
10view.setRepeatDetailsHeaderOnAllRows(false);
11view.setAlignDetailsData(StringAlignment.Near);
12project.save("task usage1.pdf", SaveFileFormat.PDF);
13
14// display details header column
15view.setDisplayDetailsHeaderColumn(true);
16// Repeat details header on all assignments rows
17view.setRepeatDetailsHeaderOnAllRows(true);
18view.setAlignDetailsData(StringAlignment.Far);
19project.save("task usage2.pdf", SaveFileFormat.PDF);
20project.save("task usage2.pdf", SaveFileFormat.PDF);