Paste microsoft office equation object(old doc format) problem

General TRichView support forum. Please post your questions here
Post Reply
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Paste microsoft office equation object(old doc format) problem

Post by wolf1860 »

I opened a doc file(97-2003 format) in Microsoft word 2016,copied a equation (ctrl+C), pasted(Ctrl+V) to TRichviewEdit(my version is 16.15.11),the result was that 2 same images displayed in the TRichviewEdit, No.1 is bigger than No.2 .
I created a new docx file ,inserted a new equation in word 2016,copied and pasted,the result is right.

thanks a lot!
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paste microsoft office equation object(old doc format) problem

Post by Sergey Tkachenko »

Please send me or attach to the topic this doc file
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: Paste microsoft office equation object(old doc format) problem

Post by wolf1860 »

I sent mail to [email protected] a moment ago,thank u!
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paste microsoft office equation object(old doc format) problem

Post by Sergey Tkachenko »

I received your file, and analyzed RTF produced by MS Word when this document is copied to the Clipboard.

RTF often contains alternative representation of the same information.
In this file I can see:
1. OLE object Equation, with an alternative representation as a metafile. TRichView reads a metafile.
2. RTF field, containing RTF math object, with an alternative representation as an image, and image has two representations, as a PNG and a metafile. TRichView reads PNG.

So you can see two pictures, metafile and PNG.
But I cannot find any information in this file specifying that this OLE object and RTF field are alternative to each other, or that one of them must be hidden. Either MS Word has a special processing for RTF containing this type of OLE objects, or I do not understand something.


If I select an equation in MS Word and copy to another document, then copy this new document to TRichView, an image is inserted only once, because new RTF contains only OLE object, without RTF field.

The problem could be solved by non-reading picture representation of RTF math objects. BUT...
If I insert an equation in the new format, RTF file contains only a math object, without OLE object. So, if TRichView would ignore it, it could not be able to read new equations.

The only solution I can suggest is adding $ifdef for ignoring pictures in RTF math objects, so you will be able to import your old documents.
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: Paste microsoft office equation object(old doc format) problem

Post by wolf1860 »

I used copy/paste function to import word document,can u give me some code to define $ifdef? By the way ,I opened the doc and select all (ctrl+a) and paste to a new document,the second image still exist,how should I do manual to avoid this problem? I can edit the original document freely.

thanks a lot!
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paste microsoft office equation object(old doc format) problem

Post by Sergey Tkachenko »

I thought out it one more time and it seems now understand what to do.
The RTF math object and its alternative picture are placed in the "field instance" section. This is an unusual situation, normally, only field codes must be there. I changed the code to ignore pictures inside the field instance, and everything looks ok now, in all cases (your document, equation copied from your document, equation inserted in new version of Word)

This change will be included in the next update.
This update is not free for users who ordered in 2015 (please note that there is a discount for renewals made before October, 15th).
But if you do not plan to renew updates now, I can send this fix by email to you.
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: Paste microsoft office equation object(old doc format) problem

Post by wolf1860 »

I did not receive the reminding email,I planned to renew updates for your sweet service!
Can u email the update to me? I 'm waiting for the patch.
By the way,you can email the discount bill together.
Thank u!
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paste microsoft office equation object(old doc format) problem

Post by Sergey Tkachenko »

I uploaded a fixed version for registered users.

We did not send emails to customers yet, we will do it after the official release of TRichView 17. I hope we will be able to do it in this week.
Currently, information is available in the protected section of this forum.

I'll send you a private message
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: Paste microsoft office equation object(old doc format) problem

Post by wolf1860 »

I have paid for the update license:) Thank u for the discount!
Post Reply