[MPXJ Series] Reading MS Project Files using MPXJ
It’s been a while since my last post on using MPXJ. You can find it here. Since then have been observing the search items and have found that need to have some simple posts related to MPXJ. So starting a series on MPXJ, which I shall keep updating as and when I learn more about it.
In the first part, let’s explore what are the different ways of reading a MPP file in MPXJ.
Pre-requisite
The article assumes that you have downloaded MPXJ release and related dependencies. If not here are the links for download
- MPXJ - http://sourceforge.net/project/showfiles.php?group_id=70649
- Dependencies - http://mpxj.sourceforge.net/dependencies.html
Now let’s get back to the original intent of reading MPP files
Lets see the simplest form of reading an MPP file
try { ProjectReader reader = ProjectReaderUtility.getProjectReader(fileName); ProjectFile projectFile = reader.read(fileName);
// ... process Project file here } catch (Exception e) { e.printStackTrace(); }
ProjectReaderUtility.getProjectReader(), provides an appropriate Reader class, based on the version of MS Project file. This is the simplest way to read an MPP file. ProjectFile is the class that contains details about the Schedule, we can iterate and extract information from it.
Alternative ways
- For reading MPX file, you can use net.sf.mpxj.mpx.MPXReader
- For reading MPP,MPT file, use net.sf.mpxj.mpp.MPPReader
- For reading MSPDI, use net.sf.mpxj.mspdi.MSPDIReader
