Using Tables in RTF

匿名 (未验证) 提交于 2019-12-03 08:59:04

问题:

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.

回答1:

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



回答2:

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



文章来源: Using Tables in RTF
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!