MPP to Excel in C#

Handling Microsoft Project MPP files and converting them into more accessible formats like Excel XLSX or XLS can be essential for project tracking and reporting. You can efficiently convert MPP files to Excel in C#. This guide covers two methods: a standard conversion and an advanced conversion with custom options.

We will be going through the following sections to understand the conversion:

Why Convert MPP to Excel?

Microsoft Project files (MPP) are ideal for managing projects, but they are not universally accessible and often require specific software to view and edit. Converting MPP to Excel offers several advantages:

  • Wider Accessibility: Excel is more widely used and accessible than Microsoft Project. By converting MPP files to Excel, you can share project data with team members who may not have access to MS Project.

  • Data Manipulation: Excel provides robust tools for data analysis, charting, and reporting. Once converted, project data can be filtered, sorted, and visualized with Excel’s powerful features, making it easier to analyze project progress.

  • Enhanced Reporting: Excel allows custom reports and dashboards, helping teams to generate visual insights and summaries that are easier to interpret and present.

  • Better Integration with Other Tools: Excel files are easily integrated with a variety of software platforms, enabling smoother data transfer and compatibility with other workflows or automation tools.

By converting MPP files to Excel, you make project data more accessible, actionable, and versatile, enhancing your ability to manage and communicate project information effectively.

MPP to Excel Conversion - C# API Configuration

For rendering Microsoft Project files to Excel format, you have to configure Conholdate.Total for .NET with the NuGet installation command below:

PM> NuGet\Install-Package Conholdate.Total

Convert MPP to Excel in C#

The standard way to convert an MPP file to Excel format (XLSX) in C# is straightforward.

  • Load the input MPP project file.
  • Save the output Excel spreadsheet.

The code sample below shows how to convert MPP to Excel in C#:

// Load the input Project file
Aspose.Tasks.Project project = new Aspose.Tasks.Project("New Project.mpp");
// Convert MPP to Excel
project.Save("MS Project.xlsx", Aspose.Tasks.Saving.SaveFileFormat.Xlsx);

The Project class is used to load the MPP file, while the Save method saves the file directly to Excel format. This approach is efficient for quick conversions without additional formatting or layout requirements.

Convert MPP to XLSX with Advanced Options in C#

For users requiring specific formatting, such as page size settings, the advanced conversion method with additional options is available. Using XlsxOptions, you can control various export settings, enhancing the layout in the final Excel document.

  • Load the source MPP file using the Project class.
  • Write the output Excel worksheet to the disk or stream.

The following code snippet demonstrates to convert MPP to XLSX in C#:

// Load the input MPP file
Aspose.Tasks.Project project = new Aspose.Tasks.Project("New Project.mpp");
// Initiate XlsxOptions class object
Aspose.Tasks.Saving.XlsxOptions options = new Aspose.Tasks.Saving.XlsxOptions();
options.PageSize = Aspose.Tasks.Visualization.PageSize.A4;
// Convert MS Project MPP to Excel XLSX
project.Save("MS Project.xlsx", options);

Here, XlsxOptions class is utilized to set the page size, making it ideal for documents intended for printing or sharing. This approach allows for greater flexibility and better control over the converted output.

Get a Free License

You may request a free temporary license to evaluate the API by testing its features to their full capacity.

Summing up

Converting MPP files to Excel in C# simplifies project data management by making it accessible in Excel. Whether you need a quick conversion or one with enhanced layout options, these methods enable seamless MPP to Excel transformations, improving your workflow and data accessibility. If you want to discuss any of your concerns, please feel free to reach out to us at the forum.

See Also