Table RTF and Wordpad

General TRichView support forum. Please post your questions here
Post Reply
sanjayk
Posts: 21
Joined: Sat Apr 29, 2006 3:41 pm

Table RTF and Wordpad

Post by sanjayk »

1) I made a simple table in the sample editor and resized the columns to make the right column much shorter.

2) Then copied it and pasted in a Wordpad document and what I got was a smaller table with both columns of the same size.

3) Then, I pasted it in MS Word and it turned out ok.

4) Then, I copied this pasted table from Word and pasted in Wordpad and it turned out ok.

This shows some sort of RTF incompatibility between RichView Table RTF and that of Wordpad that uses msftedit.dll (latest RichEdit 4.1). Is this a known problem?

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Well, Wordpad has a very rudimentary table support.
There is a double definition of table size in RTF:
- something like a grid line to which table columns must be aligned
- HTML-like keywords for cell width.
Obviously, Wordpad does not understand the latter, especially if widths are defined in %.
Probably, after reexporting from MS Word, a grid line appeared more close to the real size.
sanjayk
Posts: 21
Joined: Sat Apr 29, 2006 3:41 pm

Post by sanjayk »

Well, on more tests, it seems to be a RichEdit 4.1 bug. It changes cellx values.

The odd thing is that if I paste in a RichEdit 3, it doesn't change the cellx. But it can't really display the word wrapped tables well. So if I paste in RichEdit 3 and then take that RTF and paste in RichEdit 4.1, it works! So that might be a programmatic way to get the RTF translated to RichEdit 4.1. Quite kludgy, I agree.

BTW, how do you determine if the cell widths are set up by percentages in the ActionTest demo? Or, do I have to go at component level and see?

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In the ActionTest demo, you can see properties of the specified cell (Table Properties, tab Cells, Preferred width).

On the component level, if Cell.BestWidth<0, it is in percent.
sanjayk
Posts: 21
Joined: Sat Apr 29, 2006 3:41 pm

Post by sanjayk »

I checked that, and it is not set to percentages. Anyway, I have a solution now. Before putting the RTF into richedit, I can note all the cellx values in a dynamic array. Then after pasting, I can get its RTF and replace the cellx values with the original ones. I have not had time to try this but I am sure it will work. I am waiting for my richview order to go through before I try this. Thanks.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

FYI: TRichView saves \cellx values so that saved tables have the same size as you can see on the screen (if the document is not formatted, tables are saved as if document width = 600 pixels)
Post Reply