How to Convert Microsoft Project File to XPS in Java

In this short but comprehensive tutorial, we will teach you how to convert Microsoft Project file to XPS in Java. This conversion of MS Project MPP file to XPS in Java does not require MS Project application or any other third-party tool to be installed on the system. You can change MPP document to XPS in any of the common operating systems like MS Windows, macOS, or Linux.

Steps to Convert Microsoft Project File to XPS in Java

  1. Configure your project to add Aspose.Task library from the Maven Repository
  2. Load the sample MPP file into the Project class object
  3. Save the MPP document to XPS by calling the save function in the Project class

Here simple steps are provided that can be followed to convert MPP file format to XPS in Java by loading the source MPP file from the disc and then saving it as an XPS file. The Project class object is used for this purpose by providing the source MPP file name however, you can load this file in a variety of ways like loading from a stream or a database directly. Also, the save function in the Project class provides a number of formats other than XPS for saving the output file.

Code to Convert MPP file to XPS in Java

In this code, an unprotected MPP file is loaded whereas you can also load password protected MPP file by providing the password to open the MPP file and save it as XPS in Java. On the other hand, if you want to avoid any errors while parsing the MPP file, you can set a callback method also to handle the errors. There are many other overloads of the Project class constructor are available that can be used to load the source MPP file.

In this tutorial, we learned the conversion of MPP document to XPS in Java. If you want to learn the conversion of some other file types to XPS like MS Excel, you may visit the article on how to convert Excel to XPS in Java.

 English