We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create Project in MPP format and read the content from an ImputStream?

We store some MPP project file contents in the database as BLOB content and we can retrieve these content field as InputStream from server side. However, we do not want to write physical files to the server or client. Instead, we would like to read the InputStream’s content and retrieve the tasks’ information from it.

Is there any way to accomplish this? If so, could you provide some sample codes for it?
I read through your online documents and it appears to me that you have to store the MPP on the server before you can read it. Can you confirm if this is true?

Thanks!

Hi Ying,

Thank you for writing to Aspose support team.

The Project class of Aspose.Tasks API provides overloaded constructor for loading a Project file from InputStream which doesn’t require the stream to be saved to disc. Please have a look at the following sample code for your kind reference and let us know if we can be of any additional help to you in this regard.

Sample Code:


Project project = new Project(“test.mpp”);

ByteArrayOutputStream ostream = new ByteArrayOutputStream();

project.save(ostream, SaveFileFormat.MPP);

//Loading the Project data from an InputStream
ByteArrayInputStream istream = new ByteArrayInputStream(ostream.toByteArray());

project = new Project(istream);

project.save(“temp.pdf”, SaveFileFormat.PDF);