WordML to RTF conversion

I am using Aspose.Words 9.5.0.0 with .NET 4.0 on Visual Studio 2010 and MS Word 2007 Professional

Here is the following words I am tring to convert:

Hello

Hello

You will see there is the word Hello followed by two parapgraphs and then the word Hello again. The incoming format is WordML show below this email.

When running the code below the paragraphs between the Hello words are deleted where I end up with HelloHello

When I convert it to text and not to RTF then it works fine and doesn’t delete the paragraph marks between the Hello words.

Please tell me how I can resolve this issue.

byte[] dataIn = System.Text.Encoding.UTF8.GetBytes(strWordML);
MemoryStream msIn = new MemoryStream(dataIn);Aspose.Words.Document ADoc =

new Aspose.Words.Document(msIn);MemoryStream msOut = new MemoryStream();
ADoc.Save(msOut, Aspose.Words.SaveFormat.Rtf);

StreamReader sr = new StreamReader(msOut);
msOut.Position = 0;

string strRTF = sr.ReadToEnd();

Hi Steve,

Thanks for your inquiry.

I cannot reproduce the issue using the lastest version of Aspose.Words. You can download it from here.

If you are still having troubles could you please create a small test project which demonstrates the issue and I will take another look.

Thanks,

I have created a test application for you which will clearly demonstrate how the conversion to RTF is failing. You will also note that converting the data to text works just fine as you will see in the enclosed solution.

Is anyone working on this? If so, Please let me know. I have observed a relatively quick turnaround for support calls for other cases but this one is seemingly being ignored.

Hi Steve,

Thanks for attaching your sample application here and for your patience.

I managed to reproduce the issue. It has been logged and you will be informed when the fix is ready.

The problem is because of the CustomXmlMarkup found inside your document. As a work around for now you can move content found within these nodes into the main document tree instead and this issue does not occur. Please see the code below which is executed before saving the document to stream.

foreach (CustomXmlMarkup xml in ADoc.GetChildNodes(NodeType.CustomXmlMarkup, true).ToArray())
{
    foreach (Node node in xml.ChildNodes.ToArray())
    {
        ((CompositeNode)xml.ParentNode).InsertBefore(node, xml);
    }
    xml.Remove();
}

Thanks,

Thank You! that worked well. I appreciate the quick turnaround because I knew this wasn't going to be an easy one.

The issues you have found earlier (filed as 22795) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.