작업보기로 작업하십시오
Contents
[
Hide
Show
]C ++ API 용 Tasks는 PDF와 같은 다양한 형식으로 프로젝트 작업을 렌더링하는 것을 지원합니다. 작업 사용량은 Days, 3overths 및 Months 및 Months와 같은 다른 시간 확장 설정을 사용하여 Aspose.Tasks 의 프레젠테이션 형식을 사용하여 렌더링 할 수 있습니다.
작업 사용보기 렌더링
이 기사의 코드 스 니펫은 리소스가 할당 된 여러 작업이있는 소스 MPP 파일을 읽고 다음 단계를 사용하여 PDF를 출력하도록합니다.
- 프로젝트 클래스의 인스턴스를 만듭니다.
- 소스 MPP 파일을 읽으십시오.
- 필요한 시간 스케일 설정으로 SaveOptions 객체를 시작하십시오.
- 프레젠테이션 형식을 TaskUsage로 설정하십시오.
- 프로젝트를 PDF 출력으로 렌더링하십시오.
1// Create project instance
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"TaskUsageView.mpp");
4
5// Define the SaveOptions with required TimeScale settings as Days
6System::SharedPtr<SaveOptions> options = System::MakeObject<PdfSaveOptions>();
7options->set_Timescale(Aspose::Tasks::Visualization::Timescale::Days);
8
9// Set the Presentation format to ResourceUsage
10options->set_PresentationFormat(Aspose::Tasks::Visualization::PresentationFormat::TaskUsage);
11
12// Save the Project
13System::String outputProject = u"project_TaskUsageView_result_days_out.pdf";
14project1->Save(dataDir + outputProject, options);
15
16// Set the Tiemscale settings to ThirdsOfMonths
17options->set_Timescale(Aspose::Tasks::Visualization::Timescale::ThirdsOfMonths);
18
19// Save the Project
20outputProject = u"project_TaskUsageView_result_thirdsOfMonths_out.pdf";
21project1->Save(dataDir + outputProject, options);
22
23// Set the Timescale settings to Months
24options->set_Timescale(Aspose::Tasks::Visualization::Timescale::Months);
25
26// Save the project
27outputProject = u"project_TaskUsageView_result_months_out.pdf";
28project1->Save(dataDir + outputProject, options);
Rendering Details Column to Output in Task Usage View
Details column included in the MPP file can be rendered to the output using the View’s DisplayDetailsHeaderColumn property. This includes the list of following supported fields:
- Work
- Actual Work
- Actual Overwork time
- Baseline Work
- Baseline 1-10 Work
The following code example illustrates the usage of this property.
1// Create project instance
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"TaskUsageViewWithDetails.mpp");
4
5// Get Default view
6System::SharedPtr<UsageView> view = System::DynamicCast_noexcept<Aspose::Tasks::TaskUsageView>(project1->get_DefaultView());
7
8// Details header column will not be displayed
9view->set_DisplayDetailsHeaderColumn(false);
10view->set_RepeatDetailsHeaderOnAllRows(false);
11view->set_AlignDetailsData(System::Drawing::StringAlignment::Near);
12project1->Save(dataDir + u"task usage1_out.pdf", Aspose::Tasks::Saving::SaveFileFormat::PDF);
13
14// Display details header column
15view->set_DisplayDetailsHeaderColumn(true);
16
17// Repeat details header on all assignments rows
18view->set_RepeatDetailsHeaderOnAllRows(true);
19view->set_AlignDetailsData(System::Drawing::StringAlignment::Far);
20project1->Save(dataDir + u"task usage2_out.pdf", Aspose::Tasks::Saving::SaveFileFormat::PDF);
Rendering Task Sheet View
The code snippet in this article reads a source MPP file that has a number of tasks with assigned resources and renders these to output PDF using the following steps:
- Create an instance of the Project class.
- Read the source MPP file.
- Initiate the SaveOptions object with required timescale settings.
- Set the presentation format to TaskSheet.
- Render the project to PDF output.
1// Create project instance
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"TaskSheetView.mpp");
4
5// Set presentation format Task Sheet and save project as PDF
6System::SharedPtr<SaveOptions> options = System::MakeObject<PdfSaveOptions>();
7options->set_PresentationFormat(Aspose::Tasks::Visualization::PresentationFormat::TaskSheet);
8project1->Save(dataDir + u"TaskSheetView_out.pdf", options);