1

I need to generate MS Project (.mpp) file using PHP, as I tried generating .xml but when oppening that files with MS Project, dates and durations are lost.

I tried creating a project with the MS Project itself and saving it as a .xml but it loses dates and durations too.

EDIT: Need to be MS Project 2013 friendly, so .mpx solutions like PHPProject offer do not help...

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Have you looked at libraries like [PHPProject](https://github.com/PHPOffice/PHPProject)? – Mark Baker Apr 07 '15 at 13:25
  • Thanks Mark Baker, but I forgot to say that I need to be MS Project 2013 friendly, as .mpx are below 2010 versions. (Editing the question to be more specific in five..) – Ferran Ollé Baiget Apr 07 '15 at 13:34
  • open the mpp file in a zip program you'll probably find its just simple xml inside there so you can create your own and then save it out as a zip to create them. the file extension format should be specified on the MS website as part of their opening up proprietary formats program. also MPP files are the old document format the files ending in X are the new files (specifically designed for office 2010 and office 2013 onwards) much more advanced than the old style mpp formats always try to use the X extensions where possible. – Dave Apr 07 '15 at 13:43
  • 1
    I'm sorry to say that the **X** rule does not work on MS Project, as the recent version 2013 does not support .mpx but .mpp, take a look here: [link](https://support.office.com/en-ca/article/File-formats-supported-by-Project-2013-f2b6710f-e6c6-4767-92de-15e482776916?CorrelationId=4c967019-edff-4c1b-a410-4b3e55699d23&ui=en-US&rs=en-CA&ad=CA). **.mpx** -> Microsoft Project Exchange, **.mpp** -> Microsoft Project Plan – Ferran Ollé Baiget Apr 07 '15 at 13:50

1 Answers1

3

There's a Java-based project called MPXJ, which lets you create and manipulate Project files. You could either look at the source code and port it, or as a quick fix, just run it on the server and generate files on demand using a PHP/Java bridge (it's mentioned in the MPXJ documentation).

===

Edit: MPXJ doesn't write .mpp files.

According to the authors of MPXJ, the .mpp format is proprietary and there is no reliable way to generate the files. (See this answer - although it's from 2012, MPXJ still doesn't support writing MPP files, and the prediction about MPPX files hasn't yet come to pass.

The only way I can think of is to have a Windows server with Project installed that generates the files for you.

Community
  • 1
  • 1
Dan Blows
  • 20,846
  • 10
  • 65
  • 96
  • Thanks! I was already aware of the *Read Only* limitation of *MPXJ*, but I was hoping there was another way to do it... but it seems that there is not. I have to take a look on the Windows Server option, so I can tell you something. – Ferran Ollé Baiget Apr 07 '15 at 14:04