Search code examples
javams-projectmpxj

How to update a perticular row in mpx file using MPXWriter in java


i am trying to update mpx file using MPXWrite,

Actually i converted mpp file to mpx file so that now i am able to read all the tasks and task details. But i want to update % Completion on particular task in mpx file how i do that.

Can any one provide code for that.

Thanks in Advance.. Please help me out from this problem

// Like this i am reading mpx file

 private static void readMPX(String inputFile){

   File f = new File(inputFile);
   MPXReader read1 = new MPXReader();
   ProjectFile pFile = null;

   try{
        pFile = read1.read(f);
       }catch(Exception e){
           e.printStackTrace();
       }
    List llist=pFile.getAllTasks();

   for(int i=1;i<10/*llist.size()*/;i++)
   {

   Task t=(Task)llist.get(i);
   System.out.println("------------------------------------");
   System.out.println("Task Details : "+i  +llist.get(i));
   System.out.println("WBS : "+t.getWBS());
   System.out.println("WBS Leve : "+t.getWBSLevel());
   System.out.println("Task name : "+t.getName());
   System.out.println("Duration : "+t.getDuration());
   //System.out.println("Task Unique ID : "+t.getUniqueID());
 //  System.out.println("Task Unique ID : "+t.getUniqueID());
   System.out.println("Base Line Start : "+t.getBaselineStart());
   System.out.println("Base Line Finish : "+t.getBaselineFinish());
   System.out.println("Actual Start Date : "+t.getActualStart());
 //  System.out.println("\tFinish Date : "+t.getFinish());
   System.out.println("Actual End Date : "+t.getActualFinish());
   System.out.println("% Complete : "+t.getPercentageComplete());
   //getSubTasks(t,t.getUniqueID());
   System.out.println("------------------------------------");
   }

  }

Solution

  • Its a restriction from Microsoft. We cant write back to mpp file.