How to disable RTF table borders in an CRichEditCtrl?

1.5k Views Asked by At

I've run into a problem with CRichEditCtrl. I'd like to use a table to format a generated text to display. In the rtf 1.5 specs it says, that I must specify a table border to display any but apparently some default settings of the CRichEditCtrl sets them anyway.

This code:

    CString sDoc =_T("{\\rtf1\\ansi\\deff0" 
                "\\trowd\\trgaph144 "
                    "\\cellx500"
                    "\\cellx3000"
                    "\\cellx5000"
                    "\\cellx7000"
                    "\\intbl 01 \\cell"
                    "\\intbl Hexachlorbenzol \\cell"
                    "\\intbl 500.00 mg \\cell"
                    "\\intbl WST \\cell"
                "\\row"
            "}");

EDITSTREAM es;
es.dwCookie = (DWORD)&sDoc;
es.pfnCallback = MEditStreamInCallback;
edtInfo.StreamIn(SF_RTF, es);

results in:

Output

I've tried to set the cell's border width to 0 and borde color to white to 0.

"\\clbrdrt\\brdrw0\\clbrdrl\\brdrw0\\clbrdrb\\brdrw0\\clbrdrr\\brdrw0"

or

 "\\clbrdrt\\brdrcf0\\clbrdrl\\brdcf0\\clbrdrb\\brdrcf0\\clbrdrr\\brdrcf0"

It doesn't work either way. The result is always the same.

Perhaps someone here knows how to disable this, obviously, default border.I want to to disable or hide this border. Maybe there is a setting for it in the control, i haven't discovered yet.

1

There are 1 best solutions below

0
Sky Diver 08 On

The Rich Edit 3 control always displays tables with borders. You can upgrade your code to use Rich Edit 4.1 if you wish to have control over the borders. If you do much with tables, you will find Rich Edit 4.1 far superior. It supports multiple paragraphs in a cell, text alignment within a cell, and more.

See https://msdn.microsoft.com/en-us/library/windows/desktop/bb787873%28v=vs.85%29.aspx for the DLL to load and the class name for Rich Edit 4.1. Rich Edit 4.1 is available on Windows XP SP1 and higher. For more information about different versions, see http://blogs.msdn.com/b/murrays/archive/2006/10/14/richedit-versions.aspx