Working with Projects

When working with Microsoft Project files in .NET applications, Aspose.Tasks for .NET provides a rich set of APIs to create, read, modify, and save projects in multiple formats such as MPP, XML, MPX, XLSX, and Primavera formats. This section explains typical developer workflows with practical C# code snippets.

Loading Projects

You can load Microsoft Project files (.mpp, .mpt, .xml, .mpx) directly into a Project object:

 1    using Aspose.Tasks;
 2
 3    // Load a project from MPP file
 4    var project = new Project("project.mpp");
 5
 6    // Load a project from XML
 7    var xmlProject = new Project("project.xml");
 8
 9    // Load from Stream
10    using (var stream = File.OpenRead("project.mpp"))
11    {
12        var streamProject = new Project(stream);
13    }

Saving and Converting Projects

Aspose.Tasks supports saving projects back to different formats:

1    // Save as XML
2    project.Save("output.xml", SaveFileFormat.XML);
3
4    // Save as MPP (requires MPP license option)
5    project.Save("output.mpp", SaveFileFormat.Mpp);
6
7    // Save as PDF for reporting
8    project.Save("report.pdf", SaveFileFormat.Pdf);

Supported formats include: MPP, MPT, XML, XAML, MPX, PDF, HTML, XLSX, Primavera (XER), and images (PNG/JPEG/TIFF).

Utility Features

Aspose.Tasks includes additional utilities for project developers:

For details, see:

Summary

Aspose.Tasks for .NET provides complete control over Microsoft Project data in C# applications:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.