This topic entails how to convert MPP to Excel using Java by providing detailed configuration steps and a runnable sample code to perform the execution of the task. The required resources are well defined to develop an application to export MS Project file to Excel using Java that results in the creation of an XLSX file on the disk.
Steps to Convert MPP file to Excel using Java
- Configure the development environment to add Aspose.Tasks for Java using the repository manager
- Open an existing or create a default empty MPP file using an instance of the Project class to convert MPP to Excel
- Add some root tasks and sub tasks for the root task if required
- Save the resultant MPP project file as an Excel file on the disk
The aforementioned steps provide an easy way to convert MS Project file to Excel using Java by exposing a stepwise procedure and a runnable example code. You can also load an existing MPP file using an overloaded constructor of the Project class that accepts the path of the MPP file and then save it to the desired format like XLSX, HTML, PNG, etc. using the SaveFileFormat enumerator. There are some other overloads for the save method available including saving the output to a memory stream.
Code to Convert MS Project to Excel using Java
In order to convert an MPP file to Excel using Java, you can load the source MPP file from the disk by providing a file path. However, there are many other options available as well including loading from a memory stream from sources like the web or databases. You have the provision to save the MPP as an Excel file by setting a range of tasks by providing the start date and end date, setting the number of pages and setting the task filters by using the SaveOptions class object.
In this article, we have focused on developing an MPP to Excel converter using Java. You can perform other types of conversions also like SVG by following the article on how to convert MPP to SVG using Java.