Skip to content

Commit 5504667

Browse files
Updated calendar examples
1 parent 65b375b commit 5504667

File tree

8 files changed

+454
-398
lines changed

8 files changed

+454
-398
lines changed

content/english/java/calendars/_index.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ url: /java/calendars/
99
---
1010

1111
## Calendars Tutorials
12-
### [Manage Calendar Properties in Aspose.Tasks](./properties/)
13-
### [Create Calendar using Aspose.Tasks](./create/)
12+
### [Manage MS Project Calendar Properties in Aspose.Tasks](./properties/)
13+
Learn how to manage MS Project calendar properties in Java using Aspose.Tasks. This provides step-by-step guidance for calendar within your Java applications.
14+
### [Create MS Project Calendars using Aspose.Tasks](./create/)
15+
Learn how to create MS Project Calendars using Aspose.Tasks for Java. Streamline project management with ease.
1416
### [Define Weekdays in Calendar with Aspose.Tasks](./define-weekdays/)
17+
Learn how to define weekdays in MS Project Calendar using Aspose.Tasks for Java. Customize working days and timings effortlessly.
1518
### [Get Working Hours from Calendar using Aspose.Tasks](./working-hours/)
19+
Extract working hours from MS Project calendars easily with Aspose.Tasks for Java. Simplify project management tasks.
1620
### [Make Standard Calendar in Aspose.Tasks](./make-standard/)
17-
### [Read Work Weeks from Calendar with Aspose.Tasks](./read-work-weeks/)
18-
### [Update Calendar to MPP Format in Aspose.Tasks](./update-to-mpp/)
21+
Learn how to create a standard MS Project calendar in Java using Aspose.Tasks. Enhance your project management capabilities with this step-by-step tutorial.
22+
### [Read Work Weeks from MS Project Calendar with Aspose.Tasks](./read-work-weeks/)
23+
Learn how to read work weeks from MS Project calendar using Aspose.Tasks for Java. Get step-by-step instructions in this comprehensive tutorial.
24+
### [Update MS Project Calendars to MPP Format with Aspose.Tasks](./update-to-mpp/)
25+
Learn how to update MS Project calendars to MPP format effortlessly using Aspose.Tasks for Java.
Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,65 @@
11
---
2-
title: Create Calendar using Aspose.Tasks
2+
title: Create MS Project Calendars using Aspose.Tasks
33
linktitle: Create Calendar using Aspose.Tasks
44
second_title: Aspose.Tasks Java API
5-
description:
5+
description: Learn how to create MS Project Calendars using Aspose.Tasks for Java. Streamline project management with ease.
66
type: docs
77
weight: 11
88
url: /java/calendars/create/
99
---
10+
## Introduction
11+
In today's digital era, efficient project management is vital for businesses to thrive. Aspose.Tasks for Java emerges as a powerful tool in this domain, facilitating seamless manipulation of Microsoft Project files programmatically. This tutorial will guide you through the process of creating an MS Project Calendar using Aspose.Tasks for Java. By following these steps, you'll be able to enhance your project management capabilities and streamline your workflow effectively.
12+
## Prerequisites
13+
Before diving into the tutorial, ensure that you have the following prerequisites in place:
14+
### Java Development Environment
15+
Ensure you have Java Development Kit (JDK) installed on your system.
16+
### Aspose.Tasks Library
17+
Download the Aspose.Tasks for Java library from the [website](https://releases.aspose.com/tasks/java/) and include it in your Java project.
1018

11-
## Complete Source Code
19+
## Import Packages
20+
To begin, import the necessary packages in your Java code:
1221
```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-
2322
import com.aspose.tasks.*;
24-
25-
26-
public class CreateCalendar {
27-
public static void main(String[] args) {
28-
// ExStart: CreateCalendar
29-
// The path to the documents directory.
30-
String dataDir = "Your Data Directory";
31-
32-
// Create a project instance
33-
Project prj = new Project();
34-
35-
// Define Calendar
36-
Calendar cal1 = prj.getCalendars().add("no info");
37-
Calendar cal2 = prj.getCalendars().add("no name");
38-
Calendar cal3 = prj.getCalendars().add("cal3");
39-
40-
// Save the Project
41-
prj.save(dataDir + "project.xml", SaveFileFormat.Xml);
42-
43-
// Display result of conversion.
44-
System.out.println("Process completed Successfully");
45-
// ExEnd: CreateCalendar
46-
}
47-
}
48-
4923
```
24+
## Step 1: Set Data Directory Path
25+
Define the path to your data directory where the project file will be saved:
26+
```java
27+
String dataDir = "Your Data Directory";
28+
```
29+
## Step 2: Create Project Instance
30+
Instantiate a Project object to start working with MS Project files:
31+
```java
32+
Project prj = new Project();
33+
```
34+
## Step 3: Define Calendars
35+
Define the calendars that you want to add to your project:
36+
```java
37+
Calendar cal1 = prj.getCalendars().add("no info");
38+
Calendar cal2 = prj.getCalendars().add("no name");
39+
Calendar cal3 = prj.getCalendars().add("cal3");
40+
```
41+
## Step 4: Save the Project
42+
Save the project with the added calendars:
43+
```java
44+
prj.save(dataDir + "project.xml", SaveFileFormat.Xml);
45+
```
46+
## Step 5: Display Completion Message
47+
Print a message indicating the successful completion of the process:
48+
```java
49+
System.out.println("Process completed Successfully");
50+
```
51+
By following these simple steps, you've successfully created an MS Project Calendar using Aspose.Tasks for Java.
52+
53+
## Conclusion
54+
Aspose.Tasks for Java empowers developers with robust functionalities to manipulate MS Project files programmatically. By leveraging its capabilities, you can enhance project management efficiency and streamline workflows seamlessly.
55+
## FAQ's
56+
### Q: Can Aspose.Tasks for Java handle complex project structures?
57+
A: Yes, Aspose.Tasks for Java provides comprehensive support for managing intricate project structures with ease.
58+
### Q: Is Aspose.Tasks for Java compatible with different versions of MS Project files?
59+
A: Absolutely, Aspose.Tasks for Java supports various versions of MS Project files, ensuring compatibility across different environments.
60+
### Q: Can I integrate Aspose.Tasks for Java with other Java libraries?
61+
A: Yes, Aspose.Tasks for Java can be seamlessly integrated with other Java libraries to enhance functionality and achieve specific requirements.
62+
### Q: Does Aspose.Tasks for Java offer support for recurring tasks?
63+
A: Yes, Aspose.Tasks for Java facilitates the management of recurring tasks, enabling efficient scheduling and tracking.
64+
### Q: Is there a community forum for Aspose.Tasks for Java users?
65+
A: Yes, you can find valuable resources and engage with the community at the [Aspose.Tasks forum](https://forum.aspose.com/c/tasks/15).

content/english/java/calendars/define-weekdays/_index.md

Lines changed: 72 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,83 @@
22
title: Define Weekdays in Calendar with Aspose.Tasks
33
linktitle: Define Weekdays in Calendar with Aspose.Tasks
44
second_title: Aspose.Tasks Java API
5-
description:
5+
description: Learn how to define weekdays in MS Project Calendar using Aspose.Tasks for Java. Customize working days and timings effortlessly.
66
type: docs
77
weight: 12
88
url: /java/calendars/define-weekdays/
99
---
10-
11-
## Complete Source Code
10+
## Introduction
11+
In this tutorial, we will walk through the process of defining weekdays in an MS Project Calendar using Aspose.Tasks for Java. Aspose.Tasks is a powerful Java library that enables developers to manipulate Microsoft Project files programmatically.
12+
## Prerequisites
13+
Before we begin, ensure you have the following prerequisites in place:
14+
1. Java Development Kit (JDK): Make sure you have JDK installed on your system. You can download it from the [official Oracle website](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) if you haven't already.
15+
2. Aspose.Tasks for Java Library: Download and install the Aspose.Tasks for Java library from the [download page](https://releases.aspose.com/tasks/java/). Follow the installation instructions provided in the documentation.
16+
17+
## Import Packages
18+
To start, import the necessary packages required for working with Aspose.Tasks in your Java project:
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.*;
24-
25-
2621
import java.util.GregorianCalendar;
27-
28-
public class DefineWeekdays {
29-
public static void main(String[] args) {
30-
// ExStart: DefineWeekdays
31-
// The path to the documents directory.
32-
String dataDir = "Your Data Directory";
33-
34-
// Create a project instance
35-
Project prj = new Project();
36-
37-
// Define Calendar
38-
Calendar cal = prj.getCalendars().add("Calendar1");
39-
40-
// Add working days Monday through Thursday with default timings
41-
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Monday));
42-
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Tuesday));
43-
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Wednesday));
44-
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Thursday));
45-
cal.getWeekDays().add(new WeekDay(DayType.Saturday));
46-
cal.getWeekDays().add(new WeekDay(DayType.Sunday));
47-
48-
// Set Friday as short working day
49-
WeekDay myWeekDay = new WeekDay(DayType.Friday);
50-
51-
// Sets working time. Only time part of date-time is important
52-
WorkingTime wt1 = new WorkingTime(
53-
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 9, 0, 0).getTime(),
54-
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 12, 0, 0).getTime()
55-
);
56-
57-
WorkingTime wt2 = new WorkingTime(
58-
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 13, 0, 0).getTime(),
59-
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 16, 0, 0).getTime()
60-
);
61-
62-
myWeekDay.getWorkingTimes().add(wt1);
63-
myWeekDay.getWorkingTimes().add(wt2);
64-
myWeekDay.setDayWorking(true);
65-
cal.getWeekDays().add(myWeekDay);
66-
67-
// Save the Project
68-
prj.save(dataDir + "project.xml", SaveFileFormat.Xml);
69-
70-
// Display result of conversion.
71-
System.out.println("Process completed Successfully");
72-
// ExEnd: DefineWeekdays
73-
}
74-
}
75-
76-
77-
78-
79-
8022
```
23+
## Step 1: Create a Project Instance
24+
Instantiate a Project object, which represents the MS Project file you will be working with:
25+
```java
26+
// The path to the documents directory.
27+
String dataDir = "Your Data Directory";
28+
Project prj = new Project();
29+
```
30+
## Step 2: Define Calendar
31+
Create a new calendar instance and add it to the project:
32+
```java
33+
Calendar cal = prj.getCalendars().add("Calendar1");
34+
```
35+
## Step 3: Add Working Days
36+
Define the working days by adding Monday through Thursday with default timings:
37+
```java
38+
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Monday));
39+
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Tuesday));
40+
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Wednesday));
41+
cal.getWeekDays().add(WeekDay.createDefaultWorkingDay(DayType.Thursday));
42+
```
43+
## Step 4: Set Custom Working Day
44+
Define Saturday and Sunday as working days:
45+
```java
46+
cal.getWeekDays().add(new WeekDay(DayType.Saturday));
47+
cal.getWeekDays().add(new WeekDay(DayType.Sunday));
48+
```
49+
## Step 5: Set Short Working Day
50+
Set Friday as a short working day with custom working times:
51+
```java
52+
WeekDay myWeekDay = new WeekDay(DayType.Friday);
53+
WorkingTime wt1 = new WorkingTime(
54+
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 9, 0, 0).getTime(),
55+
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 12, 0, 0).getTime()
56+
);
57+
WorkingTime wt2 = new WorkingTime(
58+
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 13, 0, 0).getTime(),
59+
new GregorianCalendar(1, java.util.Calendar.JANUARY, 1, 16, 0, 0).getTime()
60+
);
61+
myWeekDay.getWorkingTimes().add(wt1);
62+
myWeekDay.getWorkingTimes().add(wt2);
63+
myWeekDay.setDayWorking(true);
64+
cal.getWeekDays().add(myWeekDay);
65+
```
66+
## Step 6: Save the Project
67+
Save the modified project to an XML file:
68+
```java
69+
prj.save(dataDir + "project.xml", SaveFileFormat.Xml);
70+
```
71+
72+
## Conclusion
73+
Congratulations! You've successfully defined weekdays in an MS Project Calendar using Aspose.Tasks for Java. You can now integrate this functionality into your Java applications to manipulate MS Project files programmatically.
74+
## FAQ's
75+
### Q1: Can I define custom non-working days using Aspose.Tasks for Java?
76+
A: Yes, you can define custom non-working days by setting the `DayWorking` property to `false` for the respective weekday.
77+
### Q2: How can I add holidays to the calendar?
78+
A: You can add holidays by creating instances of `CalendarExceptions` and specifying the non-working dates.
79+
### Q3: Is Aspose.Tasks compatible with different versions of MS Project files?
80+
A: Yes, Aspose.Tasks supports various versions of MS Project files, including MPP, MPT, and XML formats.
81+
### Q4: Can I modify existing calendars in an MS Project file?
82+
A: Yes, you can load an existing project with calendars, make modifications, and then save the changes back to the original file.
83+
### Q5: Does Aspose.Tasks provide support for recurring tasks?
84+
A: Yes, Aspose.Tasks allows you to work with recurring tasks, including defining their recurrence patterns and durations.

content/english/java/calendars/make-standard/_index.md

Lines changed: 52 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,64 @@
22
title: Make Standard Calendar in Aspose.Tasks
33
linktitle: Make Standard Calendar in Aspose.Tasks
44
second_title: Aspose.Tasks Java API
5-
description:
5+
description: Learn how to create a standard MS Project calendar in Java using Aspose.Tasks. Enhance your project management capabilities with this step-by-step tutorial.
66
type: docs
77
weight: 14
88
url: /java/calendars/make-standard/
99
---
1010

11-
## Complete Source Code
12-
```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-
11+
## Introduction
12+
In this tutorial, we will delve into the world of Aspose.Tasks for Java, a powerful library that allows developers to manipulate Microsoft Project files seamlessly. Specifically, we will focus on creating a standard MS Project calendar using Aspose.Tasks. By the end of this guide, you will have a solid understanding of how to implement this functionality in your Java applications.
13+
## Prerequisites
14+
Before diving into this tutorial, make sure you have the following prerequisites in place:
15+
### Java Development Kit (JDK) Installation
16+
Ensure that you have Java Development Kit (JDK) installed on your system. You can download and install the latest version of JDK from the official Oracle website.
17+
### Aspose.Tasks for Java Library
18+
Download and set up the Aspose.Tasks for Java library. You can obtain the library from the [download page](https://releases.aspose.com/tasks/java/).
2219

20+
## Import Packages
21+
Before we begin coding, let's import the necessary packages:
22+
```java
2323
import com.aspose.tasks.*;
24+
```
2425

25-
26-
public class MakeStandardCalendar {
27-
public static void main(String[] args) {
28-
// ExStart: MakeStandardCalendar
29-
// The path to the documents directory.
30-
String dataDir = "Your Data Directory";
31-
32-
//Create a project instance
33-
Project project = new Project();
34-
35-
//Define Calendar and make it standard
36-
Calendar cal1 = project.getCalendars().add("My Cal");
37-
Calendar.makeStandardCalendar(cal1);
38-
39-
//Save the Project
40-
project.save(dataDir + "project.xml", SaveFileFormat.Xml);
41-
42-
//Display result of conversion.
43-
System.out.println("Process completed Successfully");
44-
// ExEnd: MakeStandardCalendar
45-
}
46-
}
47-
48-
49-
50-
51-
26+
## Step 1: Set up the Data Directory
27+
```java
28+
String dataDir = "Your Data Directory";
29+
```
30+
Replace `"Your Data Directory"` with the path to your desired data directory.
31+
## Step 2: Create a Project Instance
32+
```java
33+
Project project = new Project();
34+
```
35+
This line initializes a new Project instance.
36+
## Step 3: Define and Make the Calendar Standard
37+
```java
38+
Calendar cal1 = project.getCalendars().add("My Cal");
39+
Calendar.makeStandardCalendar(cal1);
40+
```
41+
Here, we define a calendar named "My Cal" and make it standard.
42+
## Step 4: Save the Project
43+
```java
44+
project.save(dataDir + "project.xml", SaveFileFormat.Xml);
5245
```
46+
This step saves the project with the defined calendar to an XML file.
47+
## Step 5: Display Completion Message
48+
```java
49+
System.out.println("Process completed Successfully");
50+
```
51+
Finally, we print a message indicating successful completion of the process.
52+
53+
## Conclusion
54+
In this tutorial, we've explored how to create a standard MS Project calendar using Aspose.Tasks for Java. By following the step-by-step guide, you can seamlessly integrate this functionality into your Java applications, enhancing their project management capabilities.
55+
## FAQ's
56+
### Q: Is Aspose.Tasks compatible with all versions of Microsoft Project?
57+
A: Yes, Aspose.Tasks supports various versions of Microsoft Project, ensuring compatibility across different platforms.
58+
### Q: Can I customize the calendar settings further?
59+
A: Absolutely! Aspose.Tasks provides extensive capabilities for customizing calendars according to specific project requirements.
60+
### Q: Is Aspose.Tasks suitable for enterprise-level applications?
61+
A: Certainly! Aspose.Tasks is designed to meet the needs of both small-scale and enterprise-level applications, offering scalability and reliability.
62+
### Q: Does Aspose.Tasks offer technical support for developers?
63+
A: Yes, developers can access comprehensive technical support through the Aspose.Tasks forum, ensuring timely assistance for any queries or issues.
64+
### Q: Can I try Aspose.Tasks before making a purchase?
65+
A: Yes, you can explore Aspose.Tasks through a free trial version available on the [website](https://purchase.aspose.com/buy), allowing you to evaluate its features and functionalities before making a decision.

0 commit comments

Comments
 (0)