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

Free Support Forum - aspose.com

RTF not be included correctly

Hi Team,

I’m including a RTF file into the document. The imported file is not seen in the final document. This happens for a RTF file with a specific image.

Issue is seen with OLE_big_fails.rtf, but works for OLE_big_works.rtf. I’m attaching standalone code and RTF files to replicate the issue.

I tested on Aspose.Words.For.Java 13.5 and 14.3 It fails in both these versions.

Additionally, I tried similar operation in MS Word and I’m able to include the failing RTF file successfully.

Thanks,
Kumar

public static void main(String[] args) throws Exception
{
Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);

docBuilder.write(“Inserting an RTF document”);

String path = “c:/OLE_big_fails.rtf”;
insertDocument(new Document(path), docBuilder, doc);

doc.save(“C:\test_old.doc”);
doc.save(“C:\test_old.pdf”);

System.out.println(“done”);
}

@SuppressWarnings(“unchecked”)
private static void insertDocument(Document srcDoc, DocumentBuilder docBuilder, Document doc) throws Exception
{
NodeImporter importer = new NodeImporter(srcDoc, doc, ImportFormatMode.USE_DESTINATION_STYLES);
Node lastNode = docBuilder.getCurrentParagraph();
CompositeNode<?> dstStory = lastNode.getParentNode();

for (Section srcSection : srcDoc.getSections())
{
for (Node srcNode : (Iterable) srcSection.getBody())
{
Node newNode = importer.importNode(srcNode, true);

dstStory.insertAfter(newNode, lastNode);
lastNode = newNode;

}
}
docBuilder.moveTo(lastNode);
}

Hi Kumar,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10083. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Additional information. The image original size is 11 inch by 34 inch width.
MS Word max width for images: 22" (inch). You can verify image properties in Word and choose “Reset” from the properties. You will get a message from Word telling that max size is 22".

Thanks,
Kumar

Hi Kumar,

Thanks for sharing the detail. Yes, I noticed this big size image while testing the scenario. I have logged this detail in WORDSNET-10083.

Please let us know if you have any more queries.

The issues you have found earlier (filed as WORDSNET-10083) have been fixed in this .NET update and this Java update.


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