Re: NSTextView with RTF as string?
Re: NSTextView with RTF as string?
- Subject: Re: NSTextView with RTF as string?
- From: John Timmer <email@hidden>
- Date: Fri, 06 May 2005 17:34:13 -0400
Title: Re: NSTextView with RTF as string?
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.
Thanks for the pointers. I’d been using RTF because I’ve got user-generated RTF information stored in Core Data objects as data, and I couldn’t come up with a clean way to merge that into HTML text. I guess if I build up the table using HTML and then convert that to RTF, I can get everything into one container.
Thanks again,
John
_______________________________________________
This mind intentionally left blank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden