How To: Work with MPX files

Versions of Microsoft Project up to Project could read and write MPX files as a data interchange format. Versions of Project after Project 98 can only read MPX files. Other third party project planning applications continue to use MPX as a data interchange format.

The sample code below illustrates how to read data from an MPX file.

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.mpx.MPXReader;

...

MPXReader reader = new MPXReader();
ProjectFile projectFile = reader.read(inputFile);

The sample code below illustrates how to write data to an MPX file.

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.mpx.MPXWriter;

...

MPXWriter writer = new MPXWriter();
writer.write(projectFile, outputFileName);