原文:
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...
# Answer 1
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.
# Answer 2
There is a proprietary Aspose.Tasks product that can create/edit MS Project files(MPP, XML, etc.). You can use either Java/PHP Bridge to utilize Aspose.Tasks for Java on PHP(guide is here) or Aspose Cloud SDK for PHP