프로젝트 페이지로 작업합니다
C ++의 Tasks는 프로젝트에서 총 페이지 수를 검색 할 수 있습니다. Aspose.Tasks 의 시각화 네임 스페이스가 제공하는 getPageCount 메소드는 TimesCale.Days, TimesCale.Months 또는 TimesScale.ThrdSofmonths를 기반으로 렌더링하는 옵션으로 프로젝트에서 총 페이지 수를 반환합니다.
프로젝트에서 페이지 수 받기
프로젝트 클래스는 프로젝트에서 총 페이지 수를 얻는 데 사용되는 getPageCount 메소드를 노출시킵니다. 프로젝트의 총 페이지 수는 TimesCale.days, TimesCale.Months 또는 TimesCale.thoflofmonths에 대해 검색 할 수 있습니다.
PDF에 프로젝트를 저장하려면 :
- Microsoft 프로젝트 파일을로드하십시오.
- 옵션 타임 스케일 설정과 함께 getPageCount 메소드를 사용하여 프로젝트의 총 페이지 수를 가져옵니다.
프로그래밍 샘플 : 프로젝트에서 페이지 수 받기 다음 줄의 코드는 프로젝트에서 여러 페이지를 얻는 방법을 보여줍니다.
1// The path to the documents directory.
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3
4// Read the input Project file
5System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"GetNumberOfPages.mpp");
6
7// Get number of pages, Timescale.Months, Timescale.ThirdsOfMonths
8int32_t iPages = project->GetPageCount();
9iPages = project->GetPageCount(Aspose::Tasks::Visualization::Timescale::Months);
10iPages = project->GetPageCount(Aspose::Tasks::Visualization::Timescale::ThirdsOfMonths);
Programming Sample: Get the number of pages for different Views Aspose.Tasks for C++ 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// The path to the documents directory.
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3
4// Read the source Project
5System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"GetNumberOfPagesForViews.mpp");
6
7// Get number of pages, Months and ThirdsOfMonths
8System::Console::WriteLine(System::String::Format(u"Number of Pages = '{0}'",project->GetPageCount(Aspose::Tasks::Visualization::PresentationFormat::ResourceUsage, Aspose::Tasks::Visualization::Timescale::Days)));
9System::Console::WriteLine(System::String::Format(u"Number of Pages = '{0}'",project->GetPageCount(Aspose::Tasks::Visualization::PresentationFormat::ResourceUsage, Aspose::Tasks::Visualization::Timescale::Months)));
10System::Console::WriteLine(System::String::Format(u"Number of Pages = '{0}'",project->GetPageCount(Aspose::Tasks::Visualization::PresentationFormat::ResourceUsage, Aspose::Tasks::Visualization::Timescale::ThirdsOfMonths)));
Programming Sample: Get number of pages based on Start and End Dates
1System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"GetNumberOfPages.mpp");
2
3auto options = [&]{ auto tmp_0 = System::MakeObject<ImageSaveOptions>(Aspose::Tasks::Saving::SaveFileFormat::PNG); tmp_0->set_SaveToSeparateFiles(true); tmp_0->set_PageSize(Aspose::Tasks::Visualization::PageSize::A3); tmp_0->set_Timescale(Aspose::Tasks::Visualization::Timescale::Months); tmp_0->set_StartDate(project->Get<System::DateTime>(Prj::StartDate()) - System::TimeSpan::FromDays(10)); tmp_0->set_EndDate(project->Get<System::DateTime>(Prj::FinishDate()) + System::TimeSpan::FromDays(30)); return tmp_0; }();
4int32_t pageCount = project->GetPageCount(Aspose::Tasks::Visualization::PageSize::A3, Aspose::Tasks::Visualization::Timescale::Months, project->Get<System::DateTime>(Prj::StartDate()) - System::TimeSpan::FromDays(10), project->Get<System::DateTime>(Prj::FinishDate()) + System::TimeSpan::FromDays(30));
5
6System::Console::WriteLine(pageCount);