Take the 2-minute tour ×

I need to align paragraph vertically (top, center, bottom) in a RichEdit.

I googled it and found nothing about this issue. Does anybody know a workaround

to achive this. I use C++ Builder 2010, are there any VCL or Windows API way solution?

share|improve this question

1 Answer 1

I don't think TRichEdit supports Vertical Text Alignment. For example take this tiny RTF document:

{\rtf1\ansi\ansicpg1250\deff0\deflang1048{\fonttbl{\f0\fnil\fcharset0 Calibri;}}\viewkind4\uc1\pard\sa200\sl276\slmult1\qc\lang9\f0\fs22\vertalc Text\par}

When this is put into TRichEdit the "Text" is only aligned horizontally. Open the document with WordPad and it looks absolutely the same. Open it up with Ms Word and the "Text" is centered both vertically and horizontally in the page. Since TRichEdit doesn't support the \vertalc, there's no need for any kind of API to set that attribute.

share|improve this answer
@Cosmin Prund thanks for you rapid answer, TRichEdit does'nt support this but what about standart windows RichEdit controls? –  neutron Jun 14 '11 at 7:57
TRichEdit is nothing but a wrapper around the Windows-provided RichEdit control. When you load that tiny bit of RTF into TRichEdit, all it does is pass it to the standard RichEdit control. WordPad is also a wrapper around the same standard RichEdit control. If WordPad showed the text vertically aligned, or loading that RTF into TRichEdit showed it vertically aligned it would be proof the standard RichEdit control supports it and we'd be looking for hacks to use the functionality from TRichControl. –  Cosmin Prund Jun 14 '11 at 8:05
so you mean MS Word uses something different than Windows-provided RichEdit? –  neutron Jun 14 '11 at 8:16
Yes, Word has a much more complex component to display text. The Windows RichEdit can also not display any images or OLE-objects. –  Andreas Jun 14 '11 at 8:19
You may use an alternative as editor. You can access MS-Word or OpenOffice over COM-interface or there are a few commercial VCL-components. –  Andreas Jun 14 '11 at 8:20

Your Answer


