Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge Cells Vertically in RTF

Tags:

rtf

I need to programmatically generate an RTF document with a table that has a column vertically merged., e.x.

______________________________
|  merged | foo    |  hello   |
|  cell   |        |          |
|  right  |--------|----------|
|  here   | bar    |  world   |
|_________|________|__________|

I looked up online and found that the codes are \clvmgf and \clvmrg but I can't find a decent example.

I made a text rtf using MS word, but there's too much junk rtf codes in it for me to figure it out where to put the \clvmgf and \clvmrg to get this to work.

Could someone give me an rtf for above example table with no extraneous rtf codes so I can figure out how \clvmgf and \clvmrg works?

Any additional explanation would also be greatly appreciated.

Thanks!

like image 946
Jimmy Johnson Avatar asked Sep 16 '25 02:09

Jimmy Johnson


1 Answers

Here's simple RTF for the table you presented:

{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}}
\fs20\viewkind4\uc1

\trowd \clvmgf \cellx2972 \cellx6053 \cellx9134\pard\intbl merged cell right here\cell foo\cell hello\cell\row
\trowd \clvmrg \cellx2972 \cellx6053 \cellx9134\pard\intbl\cell bar\cell world\cell\row
\pard\par
}

I took the example from Alex-K and simplified it to make it easier to read.

like image 100
Sky Diver 08 Avatar answered Sep 19 '25 16:09

Sky Diver 08