프로젝트에서 개요 코드를 사용하는 방법
Contents
[
Hide
Show
]사용자 정의 개요 코드는 WBS 코드 또는 개요 번호와 다른 프로젝트 구조를 제공하는 작업 또는 리소스에 대해 정의하는 태그입니다. C ++ 용 작업을 통해 이러한 개요 코드와 별명, AlllevelSrequired, Enterprise, EnterpriseOutlineCodealias, FieldId, FieldName, Poneticalias, Guid, Masks 및 Values와 같은 속성을 검색 할 수 있습니다.
개요 읽기
프로젝트 클래스는 ollecodedefinition 항목의 모음 인 oltlinecodes를 노출시킵니다. ontlinecodedefinition은 다음 샘플 코드에 표시된 모든 세부 사항을 제공합니다.
다음 줄의 코드는 프로젝트의 개요 코드 정보를 검색합니다.
1System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"OutlineCodes.mpp");
2
3
4{
5 auto ocd_enumerator = (project->get_OutlineCodes())->GetEnumerator();
6 decltype(ocd_enumerator->get_Current()) ocd;
7 while (ocd_enumerator->MoveNext() && (ocd = ocd_enumerator->get_Current(), true))
8 {
9 System::Console::WriteLine(System::String(u"Alias = ") + ocd->get_Alias());
10 if (ocd->get_AllLevelsRequired())
11 {
12 System::Console::WriteLine(u"It contains property: must have all levels");
13 }
14 else
15 {
16 System::Console::WriteLine(u"It does not contain property: must have all levels");
17 }
18 if (ocd->get_Enterprise())
19 {
20 System::Console::WriteLine(u"It is an enterprise custom outline code.");
21 }
22 else
23 {
24 System::Console::WriteLine(u"It is not an enterprise custom outline code.");
25 }
26
27 System::Console::WriteLine(System::String(u"Reference to another custom field for which this outline code definition is an alias is = ") + ocd->get_EnterpriseOutlineCodeAlias());
28 System::Console::WriteLine(System::String(u"Field Id = ") + ocd->get_FieldId());
29 System::Console::WriteLine(System::String(u"Field Name = ") + ocd->get_FieldName());
30 System::Console::WriteLine(System::String(u"Phonetic Alias = ") + ocd->get_PhoneticAlias());
31 System::Console::WriteLine(System::String(u"Guid = ") + ocd->get_Guid());
32
33 // Display outline code masks
34
35 {
36 auto outlineMask_enumerator = (ocd->get_Masks())->GetEnumerator();
37 decltype(outlineMask_enumerator->get_Current()) outlineMask;
38 while (outlineMask_enumerator->MoveNext() && (outlineMask = outlineMask_enumerator->get_Current(), true))
39 {
40 System::Console::WriteLine(System::String(u"Level of a mask = ") + outlineMask->get_Level());
41 System::Console::WriteLine(System::String(u"Mask = ") + System::ObjectExt::ToString(outlineMask));
42 }
43 }
44
45 // Display out line code values
46
47 {
48 auto outlineMask1_enumerator = (ocd->get_Values())->GetEnumerator();
49 decltype(outlineMask1_enumerator->get_Current()) outlineMask1;
50 while (outlineMask1_enumerator->MoveNext() && (outlineMask1 = outlineMask1_enumerator->get_Current(), true))
51 {
52 System::Console::WriteLine(System::String(u"Description of outline value = ") + outlineMask1->get_Description());
53 System::Console::WriteLine(System::String(u"Value Id = ") + outlineMask1->get_ValueId());
54 System::Console::WriteLine(System::String(u"Value = ") + outlineMask1->get_Value());
55 System::Console::WriteLine(System::String(u"Type = ") + System::ObjectExt::ToString(outlineMask1->get_Type()));
56 }
57 }
58 }
59}
Check Outline Code Id Uniqueness
While working with OutlineCode, Aspose.Tasks shall check the uniqueness of the Outline Code Id and duplicate Ids will be replaced with unique values.
1System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"OutlineValues2010.mpp");
2
3System::SharedPtr<OutlineCodeDefinition> textOutline = System::MakeObject<OutlineCodeDefinition>();
4textOutline->set_FieldId(System::Convert::ToString((int)Aspose::Tasks::ExtendedAttributeTask::OutlineCode7));
5textOutline->set_Alias(u"My Outline Code");
6
7project->get_OutlineCodes()->Add(textOutline);
8
9System::SharedPtr<OutlineMask> mask = System::MakeObject<OutlineMask>();
10mask->set_Type(Aspose::Tasks::MaskType::Characters);
11textOutline->get_Masks()->Add(mask);
12
13System::SharedPtr<OutlineValue> textValue = System::MakeObject<OutlineValue>();
14textValue->set_Value(u"Text value 1");
15textValue->set_ValueId(1);
16textValue->set_Type(Aspose::Tasks::OutlineValueType::Text);
17textValue->set_Description(u"Text value descr 1");
18textOutline->get_Values()->Add(textValue);
19
20project->Save(dataDir + u"MultipleOutlineValues.mpp", Aspose::Tasks::Saving::SaveFileFormat::MPP);