Hi there
The purpose of this class is to read a MS Project file using MPXJ from http://www.mpxj.org and return the contents, this should include
1. Resources
2. Tasks
3. Predecessors
4. Assignments
5. Project Properties
MashMSProject
So Far
1. Below we see an mpp (microsoft project) file opened with ProjectLibre. There is no need for MS Project to be installed to read them using MPXJ.
2. The code being called in AppStart (a non-ui app in b4j) is all that is needed to return resources and task details from the proejct, a class called ImportMSProject
3. The returned record by the class is a Map that contains a list of all resources and tasks, the start and finish date of the project.
4. This can be customised to return all sorts of project information as per MPXJ (Microsoft Project Exchange) class specifications.
How to use the class
Thank you.
The purpose of this class is to read a MS Project file using MPXJ from http://www.mpxj.org and return the contents, this should include
1. Resources
2. Tasks
3. Predecessors
4. Assignments
5. Project Properties
MashMSProject
- ParseProjectProperties (m As Map) As MSProjectProperties
parse the property properties map to a type - ParseResource (m As Map) As MSProjectResource
parse the resource to the given type - ParseTask (m As Map) As MSProjectTask
parse the task to the given type - Parse (m As Map) As signment
parse the assignment to the given type - ParsePredecessor (m As Map) As MSProjectPredecessor
parse the predecessor to the given type - Read (dir As String, fil As String)
read the ms project file and return a map
with keys resources,assignments, tasks, predecessors etc
So Far
1. Below we see an mpp (microsoft project) file opened with ProjectLibre. There is no need for MS Project to be installed to read them using MPXJ.
2. The code being called in AppStart (a non-ui app in b4j) is all that is needed to return resources and task details from the proejct, a class called ImportMSProject
3. The returned record by the class is a Map that contains a list of all resources and tasks, the start and finish date of the project.
4. This can be customised to return all sorts of project information as per MPXJ (Microsoft Project Exchange) class specifications.
How to use the class
B4X:
'initialize the ms project reader
Dim imsp As MashMSProject
imsp.Initialize
'process the reading of the ms project file
imsp.Read(File.dirapp,"office.mpp")
'check if this is initialized
'read the project propeties
Dim properties As Map = imsp.Properties
'read the project properties and parse them to a type
Dim prop As MSProjectProperties
prop = imsp.ParseProjectProperties(properties)
Log(prop.title)
'read the rest of the project stuff
Dim resources As List = imsp.Resources
Dim tasks As List = imsp.Tasks
Dim assignments As List = imsp.Assignments
Dim predecessors As List = imsp.Predecessors
For Each resource As Map In resources
Dim res As MSProjectResource
res = imsp.ParseResource(resource)
Log(res.name)
Next
For Each task As Map In tasks
Dim tsk As MSProjectTask
tsk = imsp.ParseTask(task)
Log(tsk.name)
Log(tsk.complete)
Next
For Each assignment As Map In assignments
Dim assign As MSProjectAssignment
assign = imsp.ParseAssignment(assignment)
Log(assign.resourceuniqueid)
Log(assign.taskuniqueid)
Next
For Each predecessor As Map In predecessors
Dim pred As MSProjectPredecessor
pred = imsp.ParsePredecessor(predecessor)
Log(pred.lag)
Log(pred.sourcetask)
Log(pred.targettask)
Next
Thank you.
Last edited: