Hi!, I’ve used the method “save” with the path and saved the xml file succesfully. MS Project imports this file perfectly, but if it is saved to an OutputStream, MS Project don’t import it, it said this file is damaged, I’ve opened this file with Notepad++ and seems the problem is at the end of the file.
Here is my code using OutputStream:
…
response.setContentType(“application/xml”);
response.setHeader(“fileToUpload.zip (2.6 KB)
Content-Disposition”, “attachment; filename=file.xml”);
final OutputStream outputStream = response.getOutputStream();
project.save(outputStream, SaveFileFormat.XML);
…
Please help me!!! here send you the file generated using OutputStream
@tufao.agencia,
Thank you for writing to Aspose support team.
I have tried to open this XML file using MS Project and observed that it raises error. You have mentioned that if you simply save the xml file with path, it opens fine in MS Project. Could you please provide us the working XMLl also and share the complete working application which can be used to re-produce the scenario here. Please mention that how this source XML file was created. Is it created using Aspose.Tasks or some other tool? If it is created using Aspose.Tasks, please provide the source code for our analysis.
Thanks for your quickly response!.
I’m using AsposeTask for Java, here (2.6 KB)
the correct XML generated with path.
And here (1.2 KB)
the controller class, I’m using SpringBoot with Java 8.
Thanks
@tufao.agencia,
I have tested this scenario using following sample code and observed the issue. It is logged under Id: TASKSJAVA-382 for further investigation by the product team. You will be automatically notified once any update is received in this regard.
try (OutputStream out = new FileOutputStream("OutputStreamFileOriginal.xml"))
{
Project proj = new Project();
proj.save(out,SaveFileFormat.XML);
}
catch (IOException e)
{
e.printStackTrace();
}