一般カレンダープロパティ
Contents
[
Hide
Show
]一般カレンダープロパティ
Microsoft Projectは、カレンダーやその他の情報を使用して、プロジェクトの終了日を計算します。 C ++ APIのAspose.Tasksは、カレンダー機能をサポートしています。この記事では、設定できるカレンダープロパティを示し、それらがコードでどのように適用されるかを示しています。
カレンダーは、Microsoft Outlookでベースカレンダーを定義するために使用される多くのプロパティを公開します。
- Basecalendar - 基本カレンダー。このプロパティは、現在のカレンダーインスタンスのベースカレンダーを読み書きするためのカレンダーオブジェクトをサポートしており、現在のカレンダーインスタンスはまだ基本カレンダーではない場合にのみ適用されます。
- 名前 - カレンダーの名前。文字列でプロパティを取得または設定します。
- UID - カレンダーの一意のID。整数。
以下に示すコードの例は、一般カレンダーのプロパティを取得する方法を示しています。
1// Load an existing project
2System::String dataDir = Examples::CPP::RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"Project_GeneralCalendarProperties.xml");
4
5
6{
7 auto cal_enumerator = (project->get_Calendars())->GetEnumerator();
8 decltype(cal_enumerator->get_Current()) cal;
9 while (cal_enumerator->MoveNext() && (cal = cal_enumerator->get_Current(), true))
10 {
11 if (cal->get_Name() != nullptr)
12 {
13 System::Console::WriteLine(System::String(u"UID : ") + System::Convert::ToString(cal->get_Uid()) + u" Name: " + cal->get_Name());
14
15 // Show if it is has a base calendar
16 System::Console::Write(u"Base Calendar : ");
17 if (cal->get_IsBaseCalendar())
18 {
19 System::Console::WriteLine(u"Self");
20 }
21 else
22 {
23 System::Console::WriteLine(cal->get_BaseCalendar()->get_Name());
24 }
25
26 // Get Time in hours on each working day
27
28 {
29 auto wd_enumerator = (cal->get_WeekDays())->GetEnumerator();
30 decltype(wd_enumerator->get_Current()) wd;
31 while (wd_enumerator->MoveNext() && (wd = wd_enumerator->get_Current(), true))
32 {
33 System::TimeSpan ts = wd->GetWorkingTime();
34 System::Console::WriteLine(System::String(u"Day Type: ") + System::ObjectExt::ToString(wd->get_DayType()) + u" Hours: " + System::ObjectExt::ToString(ts));
35 }
36 }
37 }
38 }
39}