This article assists in how to convert MPP to Excel using C# by providing the configuration details and a runnable simple code to perform the task. All the necessary resources are identified that are required to write this application. Note that there is no need to install MS Project or any other MPP handling software to export MS Project file to Excel using C# that results in the creation of an XLSX file.
Steps to Convert MPP file to Excel using C#
- Configure the development environment to add Aspose.Tasks using the NuGet package manager
- Create or load an existing MPP file into the Project class object to convert to Excel
- Add some tasks and sub-tasks if required
- Save the resultant project file as an Excel file
These steps provide a simple way to convert MS Project file to Excel using C# by sharing a stepwise process and a runnable sample code. If you have an existing MPP file, just load it and save it to the desired format like XLSX, HTML, PNG, etc. using the SaveFileFormat enumerator. There are a number of other overloads available also for saving the MS Project file.
Code to Convert MS Project to Excel using C#
To transform an MPP file to Excel using C# you can load the source MPP file using its name only however, many other options are available as well like you can load the project from a database or a stream. You may use LoadOptions to set the password for opening a protected project file, set some cancellation token to interrupt the file loading operation, and set the error-handling routine for reading some XML files. Similarly, you have the option to save the MPP as an Excel file by setting a range of tasks with the help of the start date and end date, setting the number of pages, and setting task filters, to name a few by using the SaveOptions class object.
In this article, we have learned to convert MPP to Excel files. You can perform other types of conversions also like XPS by following the article on how to convert Microsoft Project file to XPS in C#.