Hi Aspose,
I have a MS Document cannot convert to xps Stream. please see the attachment.
Code:
var document = new Document(filePath);
Stream s = new MemoryStream();
document.Save(s, SaveFormat.Xps);
s.Position = 0;
byte[] data = new byte[s.Length];
using(s)
{
s.Read(data, 0, data.Length);
}
Hi
Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed. As a workaround you can try open/save the attached document using MS Word and then convert to XPS using Aspose.Words.
Best regards,
Hi Aspose,
First let me thank you for providing great products and excellent support.
Because we use OpenXML SDK to create the word file, so the workaround method they provided doesn’t work. My company is testing your product, please solved the problem as soon as possible.
Hello.
Thank you for your inquiry.
Unfortunately we can not promise a quick solution to your problem. At this point analysis of the issue has not yet ended. Once developers will analyse the problem, we can tell the estimates. We will notify you of any developments.
Hi
Thanks for your request. An empty Structured Document Tag within a table causes the problem. Please see the attached screenshot. So, if you have a control over document generation process you can correct this. If not, you can just remove an empty SDT before rendering the document. For instance, see the following code:
// Open document.
Document doc = new Document(@"Test001\in.docx");
// Get collection of Structured Document tags.
Node[] sdts = doc.GetChildNodes(NodeType.StructuredDocumentTag, true).ToArray();
// Loop through all SDTs and remove empty SDTs with tables.
foreach(StructuredDocumentTag sdt in sdts)
{
if (sdt.Level == MarkupLevel.Row && !sdt.HasChildNodes)
sdt.Remove();
}
// Save document as XPS.
doc.Save(@"Test001\out.xps", SaveFormat.Xps);