Hi Support:
We are trying merge html document in rtf body with following code:
RtfSaveOptions rtfSaveOptions = new RtfSaveOptions();
Document srcDoc = new Document(rtfDoc);
builder = new DocumentBuilder(srcDoc);
builder.moveToSection(0);
builder.insertHtml(bodyHtml);
srcDoc.save(baOSMergedDoc, rtfSaveOptions);
It works fine with version 17.3 but when using version 18.1 some text from html document goes missing in the final rtf document.
I’ve attached sample rtf document and html document.SampleDocuments.zip (2.9 KB)
Thanks,
Keshav
@Maverrick2k4,
Please tell if the following simple code is acceptable for you?
// Load RTF
Document doc = new Document("D:\\temp\\RTFDoc.rtf");
// Load HTML
Document html = new Document("D:\\temp\\BodyHtml.html");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToSection(0);
// Insert HTML into RTF
builder.insertDocument(html, ImportFormatMode.KEEP_SOURCE_FORMATTING);
// Save RTF
doc.save("D:\\Temp\\awjava-18.2.rtf");
Hi,
Thanks for looking into this!
But this solution does not fix the problem in version 18.1 (Latest version available from Aspose)
Update: I tried with version 18.2 as well and problem persists.
Thanks,
Keshav
@Maverrick2k4,
We have generated a ‘awjava-18.2.rtf’ file (see awjava-18.2.zip (2.7 KB)) on our end and attached it here for your reference. Please create a comparison screenshot highlighting (encircle) the problematic areas in this Aspose.Words generated RTF file and attach it here for our reference. We will investigate the problematic areas further on our end and provide you more information. Thanks for your cooperation.
Hi Thanks for your reply!
Please have a look at html carefully. It contains the text 333333333 and 44444444 which goes missing in merged document.
I’ve attached a screenshot of html document.
HTML-SS.JPG (17.2 KB)
@Maverrick2k4,
Thanks for the additional information. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-16488. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.
@Maverrick2k4,
Regarding WORDSNET-16488, our product team has completed the work on your issue and has come to a conclusion that this issue is actually not a bug. So, we will close this issue as ‘Not a Bug’. The problem occurs because the contents of the problematic paragraphs has the “-aw-import:ignore” style, which indicates to Aspose.Words that the contents should be ignored on import. If you do not want paragraphs to be ignored, please remove “-aw-import:ignore” styles from the HTML document.
we don’t add any flag to the html.
Rtf document’s body gets converted to html by Aspose library and then later on html body is merged back.
I have checked and this “-aw-import:ignore”” and found it seems its aspose specific flag.
@Maverrick2k4,
Please also ZIP and upload source RTF document here for testing.
@Maverrick2k4,
Custom “-aw-*” CSS properties are part of round-trip information written by Aspose.Words. Output of this information can be turned off by setting the HtmlSaveOptions.ExportRoundtripInformation property to false.
However, since the scenario described is definitely a document round-trip, we don’t think it is a good idea to turn the round-trip information off. We suspect the real cause of the problem is that you incorrectly modify text of paragraphs containing spans marked as “-aw-import: ignore”. The correct way of doing this is one of the following:
Either write text into the ignored span but overwrite the   character and remove the “-aw-import: ignore” CSS style:
<p style="margin-top:0pt; margin-bottom:0pt; widows:0; orphans:0; font-size:12pt">
<span style="font-family:Arial">333333333</span>
</p>
Or write custom text into a separate span right next to the ignored span (in this case the ignored span can be removed completely, which will result in the same HTML code as above):
<p style="margin-top:0pt; margin-bottom:0pt; widows:0; orphans:0; font-size:12pt">
<span style="font-family:Arial; -aw-import:ignore"> </span><span style="font-family:Arial">333333333</span>
</p>
Hope, this helps.