Skip to content

Commit f44c138

Browse files
Updated currency properties examples
1 parent e554048 commit f44c138

File tree

3 files changed

+103
-80
lines changed

3 files changed

+103
-80
lines changed

content/english/java/currency-properties/_index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ url: /java/currency-properties/
1010

1111
## Currency Properties Tutorials
1212
### [Read Currency Properties in Aspose.Tasks Projects](./read-properties/)
13-
### [Set Currency Properties in Aspose.Tasks Projects](./set-properties/)
13+
Learn how to extract currency information from MS Project files using Aspose.Tasks for Java. Step-by-step guide provided.
14+
### [Set Currency Properties in Aspose.Tasks Projects](./set-properties/)
15+
Learn how to set currency properties in Aspose.Tasks projects using Java. Manipulate Microsoft Project files effortlessly.

content/english/java/currency-properties/read-properties/_index.md

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,58 @@
22
title: Read Currency Properties in Aspose.Tasks Projects
33
linktitle: Read Currency Properties in Aspose.Tasks Projects
44
second_title: Aspose.Tasks Java API
5-
description:
5+
description: Learn how to extract currency information from MS Project files using Aspose.Tasks for Java. Step-by-step guide provided.
66
type: docs
77
weight: 10
88
url: /java/currency-properties/read-properties/
99
---
10-
11-
## Complete Source Code
10+
## Introduction
11+
In this tutorial, we will learn how to utilize Aspose.Tasks for Java to read currency properties from Microsoft Project files. Aspose.Tasks is a powerful Java API that enables developers to manipulate Microsoft Project documents without requiring Microsoft Project to be installed. By following the steps outlined below, you'll be able to extract currency-related information effortlessly.
12+
## Prerequisites
13+
Before proceeding with this tutorial, ensure you have the following prerequisites:
14+
1. Java Development Kit (JDK): Make sure you have JDK installed on your system.
15+
2. Aspose.Tasks for Java JAR: Download the Aspose.Tasks for Java library from [here](https://releases.aspose.com/tasks/java/) and include it in your Java project.
16+
## Import Packages
17+
Begin by importing the necessary packages into your Java class:
1218
```java
13-
/*
14-
* Copyright 2001-2022 Aspose Pty Ltd. All Rights Reserved.
15-
*
16-
* This file is part of Aspose.Tasks. The source code in this file
17-
* is only intended as a supplement to the documentation, and is provided
18-
* "as is", without warranty of any kind, either expressed or implied.
19-
*/
20-
21-
22-
2319
import com.aspose.tasks.*;
24-
25-
26-
public class ReadCurrencyProperties {
27-
public static void main(String[] args) {
28-
// The path to the documents directory.
29-
String dataDir = "Your Data Directory";
30-
31-
//Create a project reader instance
32-
Project project = new Project(dataDir + "project.mpp");
33-
34-
//Display currency properties
35-
System.out.println("Currency Code : " + project.get(Prj.CURRENCY_CODE).toString());
36-
System.out.println("<br>Currency Digits : " + project.get(Prj.CURRENCY_DIGITS).toString());
37-
System.out.println("<br>Currency Symbol : " + project.get(Prj.CURRENCY_SYMBOL).toString());
38-
System.out.println("Currency Symbol Position" + project.get(Prj.CURRENCY_SYMBOL_POSITION).toString());
39-
40-
//Display result of conversion.
41-
System.out.println("Process completed Successfully");
42-
}
43-
}
44-
45-
46-
47-
48-
4920
```
21+
## Step 1: Set Up Your Project Directory
22+
First, set up your project directory where your Microsoft Project file is located. You can define this directory path as follows:
23+
```java
24+
String dataDir = "Your Data Directory";
25+
```
26+
Replace `"Your Data Directory"` with the actual path to your project directory.
27+
## Step 2: Create a Project Reader Instance
28+
Instantiate a `Project` object by providing the path to your Microsoft Project file:
29+
```java
30+
Project project = new Project(dataDir + "project.mpp");
31+
```
32+
Ensure to replace `"project.mpp"` with the name of your MS Project file.
33+
## Step 3: Display Currency Properties
34+
Retrieve and display currency properties from the project file:
35+
```java
36+
System.out.println("Currency Code : " + project.get(Prj.CURRENCY_CODE).toString());
37+
System.out.println("<br>Currency Digits : " + project.get(Prj.CURRENCY_DIGITS).toString());
38+
System.out.println("<br>Currency Symbol : " + project.get(Prj.CURRENCY_SYMBOL).toString());
39+
System.out.println("Currency Symbol Position" + project.get(Prj.CURRENCY_SYMBOL_POSITION).toString());
40+
```
41+
This code segment fetches information such as currency code, digits, symbol, and symbol position from the MS Project file and prints them to the console.
42+
## Step 4: Process Completion
43+
Lastly, print a message indicating successful completion of the process:
44+
```java
45+
System.out.println("Process completed Successfully");
46+
```
47+
## Conclusion
48+
In this tutorial, we explored how to read currency properties from Microsoft Project files using Aspose.Tasks for Java. By following the outlined steps, you can effortlessly extract currency-related information from your project files programmatically, enabling seamless integration into your Java applications.
49+
## FAQ's
50+
### Q: Is Aspose.Tasks compatible with all versions of Microsoft Project?
51+
A: Aspose.Tasks supports various versions of Microsoft Project, including MPP files generated by MS Project 2003-2021.
52+
### Q: Can I modify currency properties using Aspose.Tasks?
53+
A: Yes, Aspose.Tasks allows you to both read and modify currency properties in MS Project files programmatically.
54+
### Q: Is Aspose.Tasks suitable for commercial use?
55+
A: Yes, Aspose.Tasks is a commercial library designed for professional use. You can purchase a license [here](https://purchase.aspose.com/buy).
56+
### Q: Does Aspose.Tasks offer a free trial?
57+
A: Yes, you can avail of a free trial of Aspose.Tasks from [here](https://releases.aspose.com/).
58+
### Q: Where can I seek help or support for Aspose.Tasks?
59+
A: You can visit the Aspose.Tasks forum [here](https://forum.aspose.com/c/tasks/15) for any assistance or queries.

content/english/java/currency-properties/set-properties/_index.md

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,65 @@
22
title: Set Currency Properties in Aspose.Tasks Projects
33
linktitle: Set Currency Properties in Aspose.Tasks Projects
44
second_title: Aspose.Tasks Java API
5-
description:
5+
description: Learn how to set currency properties in Aspose.Tasks projects using Java. Manipulate Microsoft Project files effortlessly.
66
type: docs
77
weight: 11
88
url: /java/currency-properties/set-properties/
99
---
10-
11-
## Complete Source Code
10+
## Introduction
11+
In this tutorial, we'll explore how to set currency properties in Aspose.Tasks projects using Java. Aspose.Tasks is a powerful Java library that allows developers to manipulate Microsoft Project files programmatically.
12+
## Prerequisites
13+
Before we begin, ensure you have the following:
14+
1. Java Development Kit (JDK): Ensure you have JDK installed on your system.
15+
2. Aspose.Tasks for Java Library: Download and install the Aspose.Tasks for Java library from the [download link](https://releases.aspose.com/tasks/java/).
16+
3. Integrated Development Environment (IDE): Choose your preferred IDE such as Eclipse or IntelliJ IDEA.
17+
## Import Packages
18+
First, let's import the necessary packages to work with Aspose.Tasks in Java.
1219
```java
13-
/*
14-
* Copyright 2001-2022 Aspose Pty Ltd. All Rights Reserved.
15-
*
16-
* This file is part of Aspose.Tasks. The source code in this file
17-
* is only intended as a supplement to the documentation, and is provided
18-
* "as is", without warranty of any kind, either expressed or implied.
19-
*/
20-
21-
22-
2320
import com.aspose.tasks.CurrencySymbolPositionType;
2421
import com.aspose.tasks.Prj;
2522
import com.aspose.tasks.Project;
2623
import com.aspose.tasks.SaveFileFormat;
27-
28-
29-
public class SetCurrencyProperties {
30-
public static void main(String[] args) {
31-
// The path to the documents directory.
32-
String dataDir = "Your Data Directory";
33-
34-
//Create a project instance
35-
Project project = new Project();
36-
37-
//Set currency properties
38-
project.set(Prj.CURRENCY_CODE, "AUD");
39-
project.set(Prj.CURRENCY_DIGITS, 2);
40-
project.set(Prj.CURRENCY_SYMBOL, "$");
41-
project.set(Prj.CURRENCY_SYMBOL_POSITION, CurrencySymbolPositionType.After);
42-
43-
//Save the project as XML project file
44-
project.save(dataDir + "project.xml", SaveFileFormat.Xml);
45-
46-
//Display result of conversion.
47-
System.out.println("Process completed Successfully");
48-
}
49-
}
50-
51-
52-
53-
54-
5524
```
25+
## Step 1: Set Data Directory
26+
Set the data directory where your project files are located.
27+
```java
28+
String dataDir = "Your Data Directory";
29+
```
30+
## Step 2: Create Project Instance
31+
Create a new project instance using Aspose.Tasks.
32+
```java
33+
Project project = new Project();
34+
```
35+
## Step 3: Set Currency Properties
36+
Now, let's set the currency properties for the project.
37+
```java
38+
project.set(Prj.CURRENCY_CODE, "AUD");
39+
project.set(Prj.CURRENCY_DIGITS, 2);
40+
project.set(Prj.CURRENCY_SYMBOL, "$");
41+
project.set(Prj.CURRENCY_SYMBOL_POSITION, CurrencySymbolPositionType.After);
42+
```
43+
## Step 4: Save the Project
44+
Save the project with the updated currency properties.
45+
```java
46+
project.save(dataDir + "project.xml", SaveFileFormat.Xml);
47+
```
48+
## Step 5: Display Completion Message
49+
Display a message indicating the successful completion of the process.
50+
```java
51+
System.out.println("Process completed Successfully");
52+
```
53+
Congratulations! You've successfully set currency properties in an Aspose.Tasks project using Java.
54+
## Conclusion
55+
In this tutorial, we learned how to use Aspose.Tasks for Java to set currency properties in project files. With Aspose.Tasks, developers can efficiently manipulate project data, making it a valuable tool for project management applications.
56+
## FAQ's
57+
### Can I set multiple currencies in a single project using Aspose.Tasks?
58+
Yes, Aspose.Tasks allows you to handle multiple currencies within a single project file.
59+
### Is Aspose.Tasks compatible with different versions of Microsoft Project files?
60+
Yes, Aspose.Tasks supports various versions of Microsoft Project files, ensuring compatibility across different environments.
61+
### Does Aspose.Tasks provide support for custom currency formats?
62+
Absolutely, Aspose.Tasks offers flexibility in defining custom currency formats to meet specific project requirements.
63+
### Can I integrate Aspose.Tasks with other Java libraries or frameworks?
64+
Yes, Aspose.Tasks can be seamlessly integrated with other Java libraries and frameworks, enhancing its functionality and versatility.
65+
### Where can I find additional support or assistance for Aspose.Tasks?
66+
For additional support, you can visit the [Aspose.Tasks forum](https://forum.aspose.com/c/tasks/15), where you can find helpful resources and engage with the community.

0 commit comments

Comments
 (0)