Configuring Usage Views in Aspose.Tasks

Introduction

If you’re a .NET developer looking to enhance your project management capabilities, Aspose.Tasks is a powerful tool that allows you to manipulate Microsoft Project files effortlessly. In this tutorial, we’ll focus on configuring usage views using Aspose.Tasks for .NET. Follow along to gain insights into rendering task usage views with details for better project visualization.

Prerequisites

Before diving into the tutorial, make sure you have the following prerequisites in place:

  • Aspose.Tasks Library: Ensure you have the Aspose.Tasks library integrated into your .NET project. If not, you can download it here and follow the installation instructions.
  • Document Directory: Set up a directory where your project documents are stored. Replace “Your Document Directory” in the code snippets with the actual path to your document directory.

Import Namespaces

In the code snippet provided, you’ll notice the usage of certain namespaces. Make sure to include these in your project for seamless integration:

using Aspose.Tasks;
using Aspose.Tasks.Visualization;
using Aspose.Tasks.Saving;

Step 1: Render Task Usage View with Details

Let’s start by rendering a task usage view with details. Follow these steps:

Step 1.1: Load Project

// The path to th documents directory.
String DataDir = "Your Document Directory";
var project = new Project(DataDir + "TaskUsageViewWithDetails.mpp");

Step 1.2: Get the View

UsageView view = (TaskUsageView)project.DefaultView;

Step 1.3: Customize View Settings

view.DisplayDetailsHeaderColumn = false;
view.RepeatDetailsHeaderOnAllRows = false;
view.DisplayShortDetailHeaderNames = false;
view.AlignDetailsData = HorizontalStringAlignment.Near;

Step 1.4: Save Project as PDF

project.Save(DataDir + "task_usage1_out.pdf", SaveFileFormat.Pdf);

Step 2: Display Details Header Column

In this step, we’ll modify the view settings to display the details header column and save the project as PDF:

Step 2.1: Display Details Header Column

view.DisplayDetailsHeaderColumn = true;

Step 2.2: Repeat Details Header on All Rows

view.RepeatDetailsHeaderOnAllRows = true;
view.AlignDetailsData = HorizontalStringAlignment.Far;

Step 2.3: Save Project as PDF

project.Save(DataDir + "task_usage2_out.pdf", SaveFileFormat.Pdf);

Conclusion

Congratulations! You’ve successfully configured usage views in Aspose.Tasks. This tutorial provides a foundation for efficient project management and visualization using the Aspose.Tasks library.

FAQ’s

Q: Where can I find Aspose.Tasks documentation?

The comprehensive documentation is available here.

Q: How can I download Aspose.Tasks for .NET?

Download the library here.

Q: Where can I purchase Aspose.Tasks?

You can buy Aspose.Tasks here.

Q: Is there a free trial available?

Yes, explore the free trial here.

Q: Need support or have questions?

Visit the support forum here.