1 2 Previous Next 15 Replies Latest reply: Nov 6, 2008 6:31 AM by 843807 RSS

    Reading MPP file using MPXJ lib. from sourceforge?

    843807
      Hello,
      MPP file is getting read using(sourceforge mpxj lib) java but not in the proper hierarchical manner I want to read the subtask and add into databse.please suggest the solution!!!!!!!!!!!!!!!!!!!!!!!!!

      Thank You,
      Deepali Khape
        • 1. Re: Reading MPP file using MPXJ lib. from sourceforge?
          843807
          Hai,

          Below code would solve your problem of reading the mpp file using mpxj API . Below code is an example of standalone application which takes and argument of mpp file name with out extension. ex. temp.mpp file is given as "temp" argument to the application. Compile and run the file.


               
          //import com.tapsterrock.mpp.MPPFile;
          import java.util.*;
          import com.tapsterrock.mpx.MPXFile;
          import com.tapsterrock.mpx.Task;
          import com.tapsterrock.mpx.*;


          public class MPPReadTest extends Thread
          {
               public static void main(String[] args)
               {

                    try{

          int i=0;

          Runtime rt=Runtime.getRuntime();
          Process p=rt.exec("java com.tapsterrock.utility.MppMpx "+args[0]+".mpp "+args[0]+".mpx");
          p.waitFor();

          MPXFile mpx=new MPXFile(""+args[0]+".mpx");
          LinkedList llist=mpx.getChildTasks();

          for(i=0;i<llist.size();i++)
          {

          Task t=(Task)llist.get(0);

          System.out.println("Task Details : \n"+llist.get(0));

          System.out.println("\n\nTask name : "+t.getName());
          System.out.println("Task Unique ID : "+t.getUniqueID());
          System.out.println("Task Unique ID : "+t.getUniqueID());
          System.out.println("\tStart Date : "+t.getStart());
          System.out.println("\tFinish Date : "+t.getFinish());
          System.out.println("\tDuration : "+t.getDuration().getDuration());

          getSubTasks(t,t.getUniqueID());

          }

                    }catch(Exception e)
                    {
                         System.out.println("Error : "+e.toString());
                    }
               }


          public static void getSubTasks(Task tt,Integer parentTaskId)
          {
          int i=0;
          int j=0;
          Integer tempTaskId=new Integer(0);


          if(tt.getChildTasks().size()>0)
          {
          for(i=0;i<tt.getChildTasks().size();i++)
          {
          Task t=(Task)tt.getChildTasks().get(i);

          if(parentTaskId==t.getParentTask().getUniqueID())
          {
          System.out.println("\n\nTask name : "+t.getName());
          System.out.println("Task Parent Unique ID : "+t.getParentTask().getUniqueID());
          System.out.println("Task Unique ID : "+t.getUniqueID());
          System.out.println("\tStart Date : "+t.getStart());
          System.out.println("\tFinish Date : "+t.getFinish());
          System.out.println("\tDuration : "+t.getDuration().getDuration());

          tempTaskId=t.getParentTask().getUniqueID();
          }
          else
          {
          tempTaskId=t.getUniqueID();

          System.out.println("\n\nTask name : "+t.getName());
          System.out.println("Task Parent Unique ID : "+t.getParentTask().getUniqueID());
          System.out.println("Task Unique ID : "+t.getUniqueID());
          System.out.println("\tStart Date : "+t.getStart());
          System.out.println("\tFinish Date : "+t.getFinish());
          System.out.println("\tDuration : "+t.getDuration().getDuration());
          }


          LinkedList resources=t.getResourceAssignments();


          if(resources.size()>0)
          {
          for(j=0;j<resources.size();j++)
          {
          System.out.println("\n\t Task ID \t\t Task Name \t\t\t\t\t ResourceID \t\t Resource Name");
          System.out.println("\t"+t.getUniqueID()+"\t\t\t\t"+t.getName()+"\t\t"+((ResourceAssignment)resources.get(j)).getResource().getUniqueID()+"\t\t\t\t"+((ResourceAssignment)resources.get(j)).getResource().getName());
          }
          }

          if(t.getChildTasks().size()>0)
          {
          getSubTasks(t,tempTaskId);
          }
          else
          {
          }
          }
          }

          }


          }




          Regards
          Aravind.V
          • 2. Re: Reading MPP file using MPXJ lib. from sourceforge?
            843807
            Is it possible to create a MPP file from an XML file , using MPXJ package? Cansomeone give me some sample codes / usefule links?!
            Any help would be appreciated.
            Thanks,
            Vanitha
            • 3. Re: Reading MPP file using MPXJ lib. from sourceforge?
              843807
              Hi, there:

              I need to read in an MPP file on a computer that does NOT have MSProject installed on it. Can anyone out there tell me if MPXJ lib is the tool to use? Or if there is a tool out there that can read MPP files without MSProject COM files installed on the computer?

              Thank you,
              Patricia
              • 4. Re: Reading MPP file using MPXJ lib. from sourceforge?
                843807
                Hi, Aravind:

                I am trying to use MPXJ. I created a project, included the poi jar in my class path, and copied your code below into a class in my project. But all three imports for com.tapsterock cannot be resolved. I've been looking at this stuff for so long I am completely confused, so please bear with me if I'm asking stupid questions. What do I need to download, so these can be resolved?

                Thank you so much for your help,
                Patricia
                • 5. Re: Reading MPP file using MPXJ lib. from sourceforge?
                  843807
                  Nevermind....I found the file. Thanks anyway.
                  • 6. Re: Reading MPP file using MPXJ lib. from sourceforge?
                    843807
                    hi,
                    i am new to java. I want to export data from msproject to oracle database.so i need to read msproject file.
                    i tried MPXJ.but i am getting error messages.
                    could anybody tell me,what are requirments for using mpxj.Is tomcat is necessary to install.
                    what should be installation directory.

                    thanx in advance
                    • 7. Re: Reading MPP file using MPXJ lib. from sourceforge?
                      843807
                      Can anybody please help in sorting out the following error with mpxj. My MPP File name is CAPS.mpp.

                      java -classpath C:\MPP-Proto\mpxj\lib\jakarta-poi-2.5.jar;C:\MPP-Pr
                      oto\mpxj\mpxj.jar;. MPPReadTest CAPS
                      Error : com.tapsterrock.mpx.MPXException: Error reading file

                      I am just using the program available in this forum.

                      Thanks in advance....
                      • 8. Re: Reading MPP file using MPXJ lib. from sourceforge?
                        843807
                        Hi,

                        I am using this mpxj.jar for reading and wring MMP files. But strange thing is i am not able to find

                        import com.tapsterrock.mpx.MPXFile;
                        import com.tapsterrock.mpx.Task;
                        import com.tapsterrock.mpx.*;

                        the above libraries in that jar file. Do i need to use different/more jar files.

                        Plz help.

                        Thanks
                        • 9. Re: Reading MPP file using MPXJ lib. from sourceforge?
                          843807
                          I�have the same problem :(.

                          thnks
                          • 10. Re: Reading MPP file using MPXJ lib. from sourceforge?
                            843807
                            Hello,
                            i have same problem that ,
                            I want to read MPP file using(sourceforge mpxj lib) java but it gives me error com.tapsterrock.mpx.MPXException: Error reading file
                            plz. suggest the sol. for this error.
                            I want to read the subModule and add task into databse according to SusModule .please suggest the solution!!!!!!!!!!!!!!!!!!!!!!!!!

                            Thank You,
                            Rahul Chaudhari

                            Message was edited by:
                            rchaudhari
                            • 11. Re: Reading MPP file using MPXJ lib. from sourceforge?
                              843807
                              hi
                              i write code for reading mpp file
                              but it give me error that

                              com.tapsterrock.mpx.MPXException: Error reading file

                              plz. give me sol. for it
                              i want to read task accd. to sub module and store in DB
                              for this also give me sol.

                              my gmail id is,

                              rahul.planet@gmail.com

                              Thank U
                              Rahul chaudhari
                              • 12. Re: Reading MPP file using MPXJ lib. from sourceforge?
                                843807
                                Hi,
                                I want to know about these packages:

                                import com.tapsterrock.mpx.MPXFile;
                                import com.tapsterrock.mpx.Task;
                                import com.tapsterrock.mpx.*;

                                Can u give me some idea, where can i download these packages?

                                Thanks in advance.............

                                madhu
                                • 13. Re: Reading MPP file using MPXJ lib. from sourceforge?
                                  843807
                                  import com.tapsterrock.mpx.MPXFile;
                                  import com.tapsterrock.mpx.Task;
                                  import com.tapsterrock.mpx.*;

                                  the above API mentioned given here will not work...it was the older version packages ..which has been deprecated
                                  Now it has been updated..

                                  Edited by: SunJavaUser on Jan 21, 2008 1:59 AM
                                  • 14. Re: Reading MPP file using MPXJ lib. from sourceforge?
                                    843807
                                    send me the code which u written,so that the solution can be achieved
                                    1 2 Previous Next