On May 6, 2005, at 11:35 AM, John Timmer wrote: My intention for this is to build a table with a number of rows that I can determine programmatically using RTF. There doesn’t seem to be a way to control tables in a text view programmatically, so I figured i’d have to manipulate the contents more directly – I decided to just work with the contents of a template file. I found that if you delete the “\lastrow” tag, you can insert another row beneath it and close that with \lastrow.
The reason I asked the question that I did was that I apparently had the process working, as evidenced by dumping the string to the file. I just can’t seem to get them back into a text view for user view/editing afterwards. I guess I could figure out the ranges for the appropriate data and manipulate the RTF as data, see if table attributes are maintained when attributed strings are formed out of RTF and work with that formatting, or just give up and go with HTML.
First, there certainly are means of manipulating tables in a text view programmatically. There is some documentation in the works on this, but the ingredients are all there in the AppKit Tiger release notes--see the discussion of NSTextBlock et al.
Second, if you do want to work with template files, I would suggest using HTML. HTML is designed so that its source is an editable string; RTF is not.
Personally, if I were manipulating an existing table, I would choose to do so in code. If I wanted to store a canned representation of a predefined table for later insertion, with perhaps small modifications, I would probably choose to use an HTML template.
Douglas Davidson
|