Read all XML Data & Convert Word 2003 XML Document to PDF File | C# .NET

Code :-

Aspose.Tasks.Project project = new Aspose.Tasks.Project(inputPath);
project.Save(outputFile, Aspose.Tasks.Saving.SaveFileFormat.PDF);

Getting error message as - The project format is undefined.

at #=zW2rxe4EHaYmTMMFW$EOBIGI=.#=zDT6zd50=(ProjectFileInfo #=zjJ9fjx0=)
at #=z9LChlvQrb9cb6YjwWMpj$n8=.#=zDT6zd50=(ProjectFileInfo #=zWrSBXao=)
at #=z9LChlvQrb9cb6YjwWMpj$n8=.#=zna1qG8w=(Stream #=z4yEugfU=, Project #=zvd2LdiU=)
at Aspose.Tasks.Project.#=zwLLwesOrlU6J(Stream #=z4yEugfU=, ParseErrorCallback #=z8FFXSvr0yhKi, Encoding #=zdwtu5o4=, PrimaveraXmlReadingOptions #=z2N$ciZo=)
at Aspose.Tasks.Project…ctor(StreamReader reader)
at DMS_ASPOSE_Form.Form1.btnConvert_Click(Object sender, EventArgs e) in C:\CitiDev\dms\POCs\ASPOSE-LateBinding-POC\DMS_ASPOSE\DMS_ASPOSE_Form\Form1.cs:line 283

Also tried Aspose.PDF for this conversion and it is also not working.

using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document())
{

                doc.BindXml(inputPath);

                doc.Save(outputFile);
            }

test.zip (1.4 KB)

Please find attached xml file used for these conversion.

@sranjan50,

MS Word 2019 detects this XML file as Word 2003 XML Document; so please try the following C# code of Aspose.Words for .NET API:

Document doc = new Document("C:\\Temp\\test.xml");
doc.Save("C:\\Temp\\xml to.pdf");

Thanks a lot Awais Hafeez.
While using Aspose.words it removes the xml tags. I have attached the SS for your reference.

Diff.PNG (162.3 KB)

@sranjan50,

This is not Aspose.Tasks issue. This API doesn’t accept any XML for loading. It accepts the XML files with valid MS Project structure file. Otherwise, an exception message will occur.

For the sake of any corrections in Aspose.Words’ API, we have logged this problem in our issue tracking system with ID WORDSNET-22697. We will further look into the details of this problem and will keep you updated here on the status of linked issue. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-22697) have been fixed in this Aspose.Words for .NET 22.5 update also available on NuGet.