Skip to content

Commit

Permalink
Updated project file operations examples
Browse files Browse the repository at this point in the history
  • Loading branch information
muqarrab-aspose committed Feb 28, 2024
1 parent 09064e0 commit 547412a
Show file tree
Hide file tree
Showing 19 changed files with 1,009 additions and 1,023 deletions.
42 changes: 28 additions & 14 deletions content/english/java/project-file-operations/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,34 @@ url: /java/project-file-operations/

## Project File Operations Tutorials
### [Reducing Gap Between Tasks List and Footer in Aspose.Tasks](./reduce-gap-tasks-list-footer/)
### [Render Data with Format 24bppRgb in Aspose.Tasks](./render-data-format-24bppRgb/)
### [Replace Calendar in Aspose.Tasks](./replace-calendar/)
### [Reschedule Project from Start or Finish Date in Aspose.Tasks](./reschedule-project/)
### [Retrieve Calendar Info in Aspose.Tasks](./retrieve-calendar-info/)
### [Retrieve Outline Codes in Aspose.Tasks](./retrieve-outline-codes/)
Learn how to reduce the gap between MS Project task lists and footers using Aspose.Tasks for Java. Optimize project document layout effortlessly.
### [Render MS Project Data with Format 24bppRgb in Aspose.Tasks](./render-data-format-24bppRgb/)
Learn how to render MS Project data as images in Java using Aspose.Tasks. Follow our step-by-step tutorial for seamless integration.
### [Replace MS Project Calendar in Aspose.Tasks](./replace-calendar/)
Learn how to replace Microsoft Project calendar using Aspose.Tasks for Java. Step-by-step guide with code examples.
### [Retrieve MS Project Calendar Info in Aspose.Tasks](./retrieve-calendar-info/)
Learn how to retrieve MS Project calendar info using Aspose.Tasks for Java. Step-by-step guide for accessing calendar details programmatically.
### [Retrieve MS Project Outline Codes in Aspose.Tasks](./retrieve-outline-codes/)
Learn how to retrieve Microsoft Project outline codes programmatically using Aspose.Tasks for Java. Enhance your project management capabilities.
### [Save As CSV, Text, and Template in Aspose.Tasks](./save-csv-text-template/)
Learn how to save Microsoft Project files in CSV, Text, and Template formats using Aspose.Tasks for Java.
### [Save As PDF in Aspose.Tasks](./save-as-pdf/)
### [Save As SVG in Aspose.Tasks](./save-as-svg/)
### [Save Data to Excel in Aspose.Tasks](./save-data-to-excel/)
### [Save Project As JPEG in Aspose.Tasks](./save-as-jpeg/)
### [Set Attributes for New Tasks in Aspose.Tasks](./set-attributes-new-tasks/)
### [Set Time Scale Count in Aspose.Tasks](./set-time-scale-count/)
### [Update Project and Reschedule Uncompleted Work in Aspose.Tasks](./update-project-reschedule-work/)
### [Custom Views in Aspose.Tasks](./custom-views/)
Learn how to convert project files to PDF using Aspose.Tasks for Java. Simple steps for efficient conversion.
### [Convert MS Project to SVG in Java](./save-as-svg/)
Learn how to save Microsoft Project files as SVG in Java using Aspose.Tasks library. Step-by-step guide with code examples.
### [Save MS Project Data to Excel in Aspose.Tasks](./save-data-to-excel/)
Learn how to save Microsoft Project data to Excel files using Aspose.Tasks for Java. Easy integration for Java developers.
### [Convert MS Project As JPEG in Aspose.Tasks](./save-as-jpeg/)
Learn how to easily convert Microsoft Project files to JPEG images using Aspose.Tasks for Java. Boost your productivity.
### [Setting MS Project Attributes for New Tasks in Aspose.Tasks](./set-attributes-new-tasks/)
Learn how to set MS Project attributes for new tasks using Aspose.Tasks for Java. Customize task properties effortlessly with this comprehensive guide.
### [Mastering MS Project Time Scale Count in Aspose.Tasks](./set-time-scale-count/)
Learn how to effectively manage time scale count in MS Project using Aspose.Tasks for Java. Optimize project visualization and management effortlessly.
### [Update & Reschedule MS Project in Aspose.Tasks](./update-project-reschedule-work/)
Learn how to update and reschedule MS Project files programmatically using Aspose.Tasks for Java.
### [Create Custom MS Project Views in Aspose.Tasks](./custom-views/)
Learn how to create custom MS Project views effortlessly using Aspose.Tasks for Java. Enhance project management efficiency with tailored views.
### [Weekday Properties in Aspose.Tasks](./weekday-properties/)
### [Work with Project Server in Aspose.Tasks](./work-with-project-server/)
### [Write MPP Project Summary in Aspose.Tasks](./write-mpp-project-summary/)
Learn to manage weekday properties efficiently in Aspose.Tasks for Java. Customize week start dates, days per month, and more with ease.
### [Write MPP Project Summary in Aspose.Tasks](./write-mpp-project-summary/)
Learn how to write MPP project summaries in Java using Aspose.Tasks. Set and retrieve project information effortlessly.
166 changes: 71 additions & 95 deletions content/english/java/project-file-operations/custom-views/_index.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
---
title: Custom Views in Aspose.Tasks
title: Create Custom MS Project Views in Aspose.Tasks
linktitle: Custom Views in Aspose.Tasks
second_title: Aspose.Tasks Java API
description:
description: Learn how to create custom MS Project views effortlessly using Aspose.Tasks for Java. Enhance project management efficiency with tailored views.
type: docs
weight: 24
url: /java/project-file-operations/custom-views/
---

## Complete Source Code
## Introduction
In project management, customizing views can significantly enhance the clarity and efficiency of managing tasks and resources. Aspose.Tasks for Java provides powerful tools to create custom views tailored to specific project requirements. In this tutorial, we'll explore how to create custom MS Project views using Aspose.Tasks for Java, step by step.
## Prerequisites
Before we begin, ensure you have the following prerequisites:
### Java Development Environment
Make sure you have Java installed on your system.
### Aspose.Tasks for Java
Download and install Aspose.Tasks for Java from [here](https://releases.aspose.com/tasks/java/).
## Import Packages
First, import the necessary packages to your Java project:
```java


import com.aspose.tasks.Field;
import com.aspose.tasks.GanttChartView;
import com.aspose.tasks.HorizontalStringAlignment;
Expand All @@ -20,93 +26,63 @@ import com.aspose.tasks.Prj;
import com.aspose.tasks.Project;
import com.aspose.tasks.TableField;
import com.aspose.tasks.View;


public class Views {
public static void main(String[] args) {
// The path to the documents directory.
String dataDir = "Your Data Directory";

modifyViewAddColumn(dataDir);

workWithView(dataDir);

// Display result of conversion.
System.out.println("Process completed Successfully");
}

public static void modifyViewAddColumn(String dataDir)
{
// Shows how to work with Project's view and add column to the default view (which is shown when MPP file is opened in MS Project).

// Create an empty project without views
Project project = new Project();
project.set(Prj.NAME, "Test View Project");

// Modify the default view (it's a Gantt chart view).
// Or you can select view by name or by View Screen using project.View collection.
GanttChartView view = (GanttChartView) project.getDefaultView();

TableField newColumn = new TableField();
newColumn.setAlignData(HorizontalStringAlignment.Center);
newColumn.setTitle("My new column");
newColumn.setWidth(30);
newColumn.setField(Field.TaskActualDuration);

view.getTable().getTableFields().add(newColumn);

// WriteViewData flag should be used to persist modifications of view's properties.
MPPSaveOptions options = new MPPSaveOptions();
options.setWriteViewData(true);
project.save(dataDir + "modifyView_output.mpp", options);
}

public static void workWithView(String dataDir)
{
// Shows how to work with MS Project views.

// Create an empty project without views
Project project = new Project();
project.set(Prj.NAME, "Test View Project");

// Create a standard Gantt chart view
View view = new GanttChartView();

// Set some view properties
// Set a value indicating whether Microsoft Project shows the single view name in the View or the Other Views drop-down lists in the Ribbon
view.setShowInMenu(true);
// Set a value indicating whether Microsoft Project highlights the filter for a single view
view.setHighlightFilter(true);

// The writing of the next properties is not supported
// Sets the filter used in a single view
view.setFilter(null);
// Sets the group of the single view
view.setGroup(null);
// Sets the table of the single view
view.setTable(null);

// Let's tune some view settings
// Set the number of first columns to be printed on all pages
view.getPageInfo().getPageViewSettings().setFirstColumnsCount(4);
// Set a value indicating whether to print a specified number of first columns on all pages
view.getPageInfo().getPageViewSettings().setPrintFirstColumnsCountOnAllPages(true);

// Add the view to our project
project.getViews().add(view);

// WriteViewData flag should be used to persist modifications of project.Views.
MPPSaveOptions options = new MPPSaveOptions();
options.setWriteViewData(true);
project.save(dataDir + "workWithView_output.mpp", options);
// Let's check some properties of the newly added view
// Print the unique identifier of a view
System.out.println("View Uid: " + view.getUid());
// Print the screen type for the single view
System.out.println("View Screen: " + view.getScreen());
System.out.println("View Type: " + view.getType());
System.out.println("Parent Project of the view: " + view.getParentProject().get(Prj.NAME));
}
}

```
Now, let's break down the example into multiple steps:
## Step 1: Set Up Project
```java
// The path to the documents directory.
String dataDir = "Your Data Directory";
// Create an empty project without views
Project project = new Project();
project.set(Prj.NAME, "Test View Project");
```
## Step 2: Create View
```java
// Create a standard Gantt chart view
View view = new GanttChartView();
```
## Step 3: Customize View Properties
```java
// Set some view properties
view.setShowInMenu(true); // Indicate whether to show the view in the menu
view.setHighlightFilter(true); // Indicate whether to highlight the filter for the view
```
## Step 4: Tune View Settings
```java
// Tune some view settings
view.getPageInfo().getPageViewSettings().setFirstColumnsCount(4); // Set the number of first columns to print on all pages
view.getPageInfo().getPageViewSettings().setPrintFirstColumnsCountOnAllPages(true); // Indicate whether to print specified number of first columns on all pages
```
## Step 5: Add View to Project
```java
// Add the view to our project
project.getViews().add(view);
```
## Step 6: Save Project
```java
// Save the project with the created view
MPPSaveOptions options = new MPPSaveOptions();
options.setWriteViewData(true); // Use WriteViewData flag to persist modifications of project.Views
project.save(dataDir + "workWithView_output.mpp", options);
```
## Step 7: Check View Properties
```java
// Check properties of the newly added view
System.out.println("View Uid: " + view.getUid()); // Print the unique identifier of the view
System.out.println("View Screen: " + view.getScreen()); // Print the screen type for the view
System.out.println("View Type: " + view.getType()); // Print the type of the view
System.out.println("Parent Project of the view: " + view.getParentProject().get(Prj.NAME)); // Print the parent project of the view
```
## Conclusion
Custom MS Project views offer a flexible way to visualize project data according to specific needs. With Aspose.Tasks for Java, creating custom views becomes straightforward, allowing project managers to streamline their workflows effectively.
## Frequently Asked Questions
### Q1: Can I customize views beyond Gantt charts?
A: Yes, Aspose.Tasks for Java provides flexibility to customize various types of views beyond Gantt charts, including tables and graphs.
### Q2: Is Aspose.Tasks for Java suitable for large-scale projects?
A: Absolutely. Aspose.Tasks for Java is designed to handle projects of all sizes, offering robust features for efficient project management.
### Q3: Does Aspose.Tasks for Java support exporting views to different formats?
A: Yes, Aspose.Tasks for Java supports exporting views to various formats such as PDF, XLSX, and HTML, ensuring compatibility with different platforms.
### Q4: Can I automate the creation of custom views using Aspose.Tasks for Java?
A: Certainly. Aspose.Tasks for Java provides comprehensive APIs for automation, enabling developers to programmatically create and manage custom views as needed.
### Q5: Is there a community forum for Aspose.Tasks for Java support?
A: Yes, you can find assistance and engage with other users in the [Aspose.Tasks forum](https://forum.aspose.com/c/tasks/15) for Java-related queries and discussions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
title: Reducing Gap Between Tasks List and Footer in Aspose.Tasks
linktitle: Reducing Gap Between Tasks List and Footer in Aspose.Tasks
second_title: Aspose.Tasks Java API
description:
description: Learn how to reduce the gap between MS Project task lists and footers using Aspose.Tasks for Java. Optimize project document layout effortlessly.
type: docs
weight: 10
url: /java/project-file-operations/reduce-gap-tasks-list-footer/
---
## Introduction
In this tutorial, we will delve into reducing the gap between the task list and footer in Microsoft Project files using Aspose.Tasks for Java. By following these steps, you'll be able to optimize the layout of your project documents effortlessly.
## Prerequisites
Before we begin, ensure you have the following prerequisites:
1. Java Development Kit (JDK): Make sure you have JDK installed on your system.
2. Aspose.Tasks for Java Library: Download and include the Aspose.Tasks for Java library in your project. You can download it from [here](https://releases.aspose.com/tasks/java/).

## Complete Source Code
## Import Packages
Before diving into the coding part, let's import the necessary packages:
```java
/*
* Copyright 2001-2022 Aspose Pty Ltd. All Rights Reserved.
*
* This file is part of Aspose.Tasks. The source code in this file
* is only intended as a supplement to the documentation, and is provided
* "as is", without warranty of any kind, either expressed or implied.
*/



import com.aspose.tasks.HtmlSaveOptions;
import com.aspose.tasks.ImageSaveOptions;
import com.aspose.tasks.PageSize;
Expand All @@ -28,42 +25,83 @@ import com.aspose.tasks.Project;
import com.aspose.tasks.SaveFileFormat;
import com.aspose.tasks.SaveOptions;
import com.aspose.tasks.Timescale;
import java.io.IOException;
```
## Step 1: Provide the Path to Your Data Directory
```java
String dataDir = "Your Data Directory";
```
Make sure to replace `"Your Data Directory"` with the path to your actual data directory where your Microsoft Project file (`HomeMovePlan.mpp` in this example) is located.
## Step 2: Read the MPP File
```java
Project project = new Project(dataDir + "HomeMovePlan.mpp");
```
This line of code reads the Microsoft Project file named `HomeMovePlan.mpp`.
## Step 3: Set ImageSaveOptions
```java
ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFileFormat.Png);
imageSaveOptions.setReduceFooterGap(true);
imageSaveOptions.setRenderToSinglePage(false);
imageSaveOptions.setPageSize(PageSize.A0);
imageSaveOptions.setTimescale(Timescale.Days);
```
Configure the image saving options, setting `ReduceFooterGap` to `true` to reduce the gap between the task list and footer.
## Step 4: Save as Image
```java
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.png", (SaveOptions) imageSaveOptions);
```
Save the project as an image with the configured options.
## Step 5: Set PdfSaveOptions
```java
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setReduceFooterGap(true);
pdfSaveOptions.setSaveToSeparateFiles(true);
pdfSaveOptions.setPageSize(PageSize.A0);
pdfSaveOptions.setTimescale(Timescale.Days);
```
Define PDF saving options, ensuring to set `ReduceFooterGap` to `true`.
## Step 6: Save as PDF
```java
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.pdf", (SaveOptions) pdfSaveOptions);
```
Save the project as a PDF with the configured options.
## Step 7: Set HtmlSaveOptions
```java
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setReduceFooterGap(true); // set to true
htmlSaveOptions.setIncludeProjectNameInPageHeader(false);
htmlSaveOptions.setIncludeProjectNameInTitle(false);
htmlSaveOptions.setPageSize(PageSize.A0);
htmlSaveOptions.setTimescale(Timescale.Days);
```
Specify HTML saving options, setting `ReduceFooterGap` to `true`.
## Step 8: Save as HTML
```java
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.html", htmlSaveOptions);
```
Save the project as an HTML file with the configured options.

## Conclusion
In conclusion, reducing the gap between the task list and footer in Microsoft Project files is a straightforward process with Aspose.Tasks for Java. By following the steps outlined in this tutorial, you can efficiently optimize the layout of your project documents.

import java.io.IOException;
## FAQ's

public class ReducingGapBetweenTasksListAndFooter {
public static void main(String[] args) {
//ExStart: ReducingGapBetweenTasksListAndFooter
String dataDir = "Your Data Directory";
### Q: Is Aspose.Tasks compatible with all versions of Microsoft Project?

//Read the MPP file.
Project project = new Project(dataDir + "HomeMovePlan.mpp");
A: Aspose.Tasks supports Microsoft Project 2003-2019 formats, ensuring compatibility across various versions.

//Use ReduceFooterGap property to reduce the gap between list of tasks and Footer
ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFileFormat.Png);
imageSaveOptions.setReduceFooterGap(true);
imageSaveOptions.setRenderToSinglePage(false);
imageSaveOptions.setPageSize(PageSize.A0);
imageSaveOptions.setTimescale(Timescale.Days);
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.png", (SaveOptions) imageSaveOptions);
### Q: Can I customize the appearance of the footer in my project documents?

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setReduceFooterGap(true);
pdfSaveOptions.setSaveToSeparateFiles(true);
pdfSaveOptions.setPageSize(PageSize.A0);
pdfSaveOptions.setTimescale(Timescale.Days);
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.pdf", (SaveOptions) pdfSaveOptions);
A: Yes, Aspose.Tasks provides extensive options for customizing the appearance of footers, including reducing gaps and adjusting content placement.

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setReduceFooterGap(true); // set to true
htmlSaveOptions.setIncludeProjectNameInPageHeader(false);
htmlSaveOptions.setIncludeProjectNameInTitle(false);
htmlSaveOptions.setPageSize(PageSize.A0);
htmlSaveOptions.setTimescale(Timescale.Days);
project.save(dataDir + "ReducingGapBetweenTasksListAndFooter_out.html", htmlSaveOptions);
//ExEnd: ReducingGapBetweenTasksListAndFooter
}
}
### Q: Does Aspose.Tasks support saving projects in formats other than PNG, PDF, and HTML?

```
A: Yes, Aspose.Tasks supports a wide range of formats, including XLSX, XML, and MPP, among others.

### Q: Is there a trial version available for Aspose.Tasks?

A: Yes, you can download a free trial version of Aspose.Tasks from [here](https://releases.aspose.com/).

### Q: Where can I get support if I encounter any issues while using Aspose.Tasks?

A: You can get assistance from the Aspose.Tasks community forum [here](https://forum.aspose.com/c/tasks/15).
Loading

0 comments on commit 547412a

Please sign in to comment.