Free Support Forum - aspose.com

RTF Rendering problem with linked Image and Shape

Let’s begin with a good point, your products saved my day!

We just bought a license from you and it’s giving very good results.

Now, the problem.

I have RTF files to convert to images. Those files are filled with Word Tags and thus no regular RTF parser can render them.
The Aspose.Word.Document did a very good job, but for some documents I still have problems.

I attached an example of the most common document I need to integrate and which gives me troubles.
Two points:
  • The right column (a shape filled with text) is hanging in word OVER the header and/or footer area (depending on the number of lines), but no matter the number of lines, I get garbage at the top of the Shape.
  • The images at the bottom, in the footer(s), are embedded Absolute Paths to the images. But even with the image present on the local computer in the right location, it just doesn’t show.

Here is the content of the cell with one of the missing images:
[!FieldStart!] IMPORT “C:\Program Files\Microsoft Office\Clipart\brug2.bmp” \d * MERGEFORMAT \x \y[!FieldSeparator!][!FieldEnd!]¶
So without an image on this path, you get a “missing image icon” in word and better, nothing in Aspose (which looks nicer).

The customer won’t accept the lack of those images nor the garbage text at the top of the right Shape.
So, I don’t mind making some reworking of the document on the fly to embed the image in another way, but I don’t know exactly how to go about it.

What can you recommend in order to have a render which is as close to the original as possible?

Thanks in advance for your time!

Hi Stefan,


Thank you for considering Aspose.Words.
Stefan:
The right column (a shape filled with text) is hanging in word OVER the header and/or footer area (depending on the number of lines), but no matter the number of lines, I get garbage at the top of the Shape.
While using the latest version of Aspose.Words i.e. 11.1.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system as WORDSNET-6058. Your request has been linked to this issue and you will be notified as soon as it is resolved. Sorry for inconvenience.
Stefan:
The images at the bottom, in the footer(s), are embedded Absolute Paths to the images. But even with the image present on the local computer in the right location, it just doesn’t show.
Please note that, when you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call Document.UpdateFields method before saving. Please try using the following code snippet:

Document doc = new Document(@“c:\temp</span>Example.rtf”);
doc.UpdateFields();

I hope, this will help,

Best Regards,

Good evening,


Thanks for the feedback.
At this time I cannot wait for the bug fix, so I need an alternative.

What in the RTF structure is making the text jump back to the top?
I don’t see where the problem lies. Thus I cannot do any corrections.
I don’t mind reworking the documents on the fly since it’s mostly in the same place that it happens.

Also, for the images, when looking at the RTF tags, I see the following two cases:
  • IMPORT “C:\\Program Files\\Microsoft Office\\Clipart\\brug2.bmp” \d \* MERGEFORMAT
  • INCLUDEPICTURE “C:\\Program Files\\Microsoft Office\\Clipart\\brug2.bmp” \* MERGEFORMAT \d

The first one is giving me problems while the second one works. I believe I can transform the link in some way by changing the node content to make it work?
The UpdateFields() did not help me…
I tried the other Update… functions aswell to no avail.

Thanks for your time!

Hi
Stefan,


Thanks for the additional information. Unfortunately, with Aspose.Words v11.1.0, I was still unable to reproduce the issue in updating IMPORT field on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.1.0 and let us know how it goes on your side. I hope, this will help.

Secondly, currently your issue is pending for analysis. Once the issue is analyzed, we will provide you more information on the root cause of this problem. Sorry for the inconvenience.

Best Regards,

Good evening (well, night here),


I’ve been able to fix most of the problems by reworking the structure of the document around that shape on the right.

I’m still trying to fix the text being wrapped together at the top. It has to be something in the node properties since I don’t have this problem for all documents, but I don’t really know what I’m looking for here…

I understand that the issue behind the handling of the file content is being analyzed, but there must be a workaround through some coding like I did for the other display issues.
Any help would be appreciated here.

Thanks!

Hi,


Thanks for your request.

In your case, I am afraid, I cannot suggest you any programmatic workaround. So, you will have to wait for the fix. We will keep you informed and immediately let you know via this forum thread once this problem is resolved.

We apologize for your inconvenience.

Best regards,

Hello,


Well, after hours of testing and analyzing the document structure I finally found that the text was being displaced when I encountered titles which were in another Formatting Style than the rest of the content of the left shape.

Most of the text there is of style “Normal”, then I came accross a style “Heading 8” and then began my problems. So, basically, I replaced every paragraph with a new one, copying the paragraph content and the style in case it was a “Normal” style and for the others, I took the “TOC” styles and copied the font settings to keep the layout intact.

By using an unused style, it came without the settings which made the text jump which thus solved the problem.

Though I don’t know exactly which settings in the formatting created this problem, I’m just glad I’m not stuck anymore with unreadable documents.

So, there is a programmatic workaround in case someone would need it.

So, several hours later, most of the problems are corrected, but there are many little errors left and they are just too complex to fix through code (like stacked shapes which do not align, to name one).


To summarize, if the document contains Shapes with text in a complex structure (with tables on the same page, fields and/or other shapes flying around), the conversion just fails. It cannot get anywhere close to what the document looks like in Word.
For simpler documents though, it proved very good, stable and fast.

Our main concern is that we need to get a document as close as possible to the original for legal reasons. If it wasn’t for this requirement, then your product would do the trick and make our life much easier.

But in our situation, I don’t have much choice but to add an alternative conversion for more complex documents because Aspose.Words is not yet ready to undertake this task.

Regards.

Hi

Thank you for additional information. It is perfect that you managed to resolve some of the issues. Unfortunately, you are right some documents with complex structure with floating objects might be rendered improperly. This is because Aspose.Words does not support all possible wrap types of floating shapes. But such complex documents are rare. Usually such documents are not human created, but generated with some tool.

Best regards,

Well, in my particular case, I have 1000 different document templates (DOT which are then used to created RTFs), manually created all over the company by administratives.

This is part of the problem, they just didn't follow any rules for building up a document and holding a structure, which turned an auto-correction process into a living nightmare.

So I just had to give up since it is not possible to foresee what else they will imagine...

My initial tests had given me better results but at that time I didn't have all the templates. My conclusion is that, sadly enough, we're not near from getting away of virtual printers. But I look forward to the evolution of the product.

Regards,

Stefan.

Hi
Stefan,


Thank you for considering Aspose.Words and providing the additional information. Rest assured, we will keep you informed, via this forum thread, of any developments regarding the fix of your issue and let you know once it is resolved. We apologize for your inconvenience.

Best Regards,

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


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

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan