1 2 Previous Next 15 Replies Latest reply: Nov 6, 2008 6:31 AM by 843807 Go to original post RSS
      • 15. Re: Reading MPP file using MPXJ lib. from sourceforge?
        This is the code to access the mpp file

        import net.sf.mpxj.mpp.*;
        import net.sf.mpxj.Task;
        import net.sf.mpxj.ProjectFile;
        import java.util.List;
        import java.io.*;

        File file = new File(”D:\\MMPT_Project\\Project1.mpp”);
        MPPReader mppRead = new MPPReader();
        System.out.println(”mpp reader : “+ mppRead.toString());
        ProjectFile pf = mppRead.read(file);
        The above statement can also be write as
        ProjectFile pf = mppRead.read(”path of the mpp file”);
        System.out.println(”proj file : “+ pf.getMppFileType());

        List lstTask = pf.getAllTasks();

        System.out.println(”tasks count:: “+ lstTask.size());
        for(int i=1;i<lstTask.size();i++){
        System.out.println(&rdquo;tasks one:: &ldquo;+ lstTask.get(i).getName() + &rdquo; &mdash;- &ldquo;+ lstTask.get(i).getUniqueID() +&rdquo; &mdash;&ndash; &ldquo;+lstTask.get(i).getStart() + &rdquo; &mdash;&ndash; &ldquo;+ lstTask.get(i).getID());
        System.out.println(&rdquo;tasks second :: &ldquo;+ lstTask.get(i).getText2() + &rdquo; &mdash;- &ldquo;+ lstTask.get(i).getFinish() +&rdquo; &mdash;- &ldquo;+lstTask.get(i).getPercentageComplete());

        Hope this will solve the problem
        set the classpath of mpxj.jar(2.0) and poi-3.0.2-FINAL-20080204.jar
        which comes with the mpxj folder when downloaded.

        don&rsquo;t forget the classpath setting
        1 2 Previous Next