Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Tables in RTF

Tags:

rtf

I need to create a table in an RTF file. However I am not familiar with RΤF. Here is an example of a text file that these RTF files are supposed to replace:

                               GENERAL JOURNAL
                                                                        Page 1

Date     Description                              Post Ref   Debit      Credit  
------------------------------------------------------------------------------
2011
Dec 1    Utilities Expense                          512      250.00
            Cash                                    111                 250.00
               Paid electric bill for November,
               Check No. 1234

    2    Cash                                       111       35.00
            Accounts Receivable / Customer Name     115/√                30.00
            Interest Income                         412                   5.00
               Receipt of payment on account
               from Customer, Check No. 5678

         . . .

The table is supposed to have borders, but I don't know how to do this either. Some cells have to have special borders on the bottom as in this file:

                                 Company Name
                        Schedule of Accounts Receivable
                               December 31, 2011

Name                                                                   Balance
------------------------------------------------------------------------------
Adams, John                                                             354.24
Jefferson, Thomas                                                        58.35
Washington, George                                                      754.58
                                                                      --------
                                                                       1167.17
                                                                      ========

I am aware of the \cell, \row etc., but I cannot figure out how to use them properly as the documentation that I have found is not very good. Please help.

like image 693
ctype.h Avatar asked Dec 01 '11 23:12

ctype.h


2 Answers

This site is useful: http://www.pindari.com/rtf3.html

{\rtf1\ansi\deff0
\trowd
\cellx1000
\cellx2000
\cellx3000
\intbl cell 1\cell
\intbl cell 2\cell
\intbl cell 3\cell
\row
} 

This will give:

---------------------------
|cell 1 | cell 2 | cell 3 |  
---------------------------

A row is delimted with \trowd ... \row

Each cell ends with \cell

\cellx determines the right side of the corresponding cell in twips

like image 92
Jerry Avatar answered Oct 02 '22 08:10

Jerry


Editing directly in RTF becomes quickly unreadable. Pehaps this practical approach works better: - Create an example mock-up ( in Excel or Word ) using unique identifiers as placeholders ( example "(P1)" ) - Then save as RTF - Open the RTF in notepad - copy the RTF codes "as is" and replace the placeholders with actual values in your program

like image 29
Maarten Avatar answered Oct 02 '22 08:10

Maarten