通貨プロパティ
概要
Microsoft Projectにより、ユーザーはプロジェクトで表示される通貨コストを設定できます。通貨コードの設定、小数点の後に数字を設定し、通貨シンボルを定義して、読みやすく直感的な方法でコストが表示されるようにすることができます。 C ++のAspose.Tasksはこれらの機能をサポートし、開発者が通貨プロパティを設定および制御するのに役立つ一連のプロパティを提供します。このトピックでは、通貨プロパティの読み取り方法とそれらを設定する方法について説明します。
Aspose.Tasksは、通貨プロパティを管理するために、 プロジェクトクラスによって公開されるプロパティを提供します。
CurrencyCode:たとえば、USD、GBP、またはAUDなど、3文字の通貨コードが文字列として渡されます。
CurrencyDigits:小数点以降の数値、たとえば2(100.00)または3(100.000)など、整数として渡されます。
CurrencySymbol: the currency symbol, for example, $ or £, passed as a string.
CurrencySymbolPosition: the position of the currency symbol, for example before ($100) or after (100$). CurrencySymbolPosition takes a value from the CurrencySymbolPositionType enumeration.
Reading Currency Properties
The code example given below demonstrates how to read a project’s currency properties.
Writing Currency Properties
To see the currency properties in Microsoft Project:
Open the project file.
On the Tools menu, select Options.
Click the View tab and for Project 2016 Display. It will look like the one shown below.
The code example given below demonstrates how to write currency properties to the project.
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// Create a project instance
5System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"WriteCurrencyProperties.mpp");
6
7// Set currency properties
8project->Set<System::String>(Prj::CurrencyCode(), u"AUD");
9project->Set<int32_t>(Prj::CurrencyDigits(), 2);
10project->Set<System::String>(Prj::CurrencySymbol(), u"$");
11project->Set<CurrencySymbolPositionType>(Prj::CurrencySymbolPosition(), Aspose::Tasks::CurrencySymbolPositionType::After);
12
13// Save the project as XML project file
14project->Save(dataDir + u"WriteCurrencyProperties_out.xml", Aspose::Tasks::Saving::SaveFileFormat::XML);