• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Add rtf line to RTF file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add rtf line to RTF file


  • Subject: Re: Add rtf line to RTF file
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 22 Oct 2002 14:59:37 -0700

On Tuesday, October 22, 2002, at 12:59 AM, email@hidden wrote:

1) Convert the RTF to an NSMutableAttributedString (with
initWithPath:/URL:/RTF:/RTFD:/RTFDFileWrapper:documentAttributes: or
readFromURL:options:documentAttributes:).
2) Append text to the NSMutableAttributedString.
3) Convert the NSMutableAttributedString back to RTF.

Douglas Davidson


The file in question is a log rtf file. The double conversion (RTF->NSMutableString
and viceversa) is convenience method on little file but with big file is
more time expensive. I need a speed method.

As others have suggested, you may wish to reconsider the use of RTF for log files; plain text, or marked-up text (e.g. XML) are probably more suitable.

Otherwise, you can obtain a copy of the RTF spec, and start manipulating the RTF data manually. If you can suitably restrict the range of files you wish to deal with, you may be able to do something (e.g., insert additional text immediately prior to the final brace).

You will have to keep in mind that the result of converting an attributed string into RTF is a complete RTF file, not a snippet suitable for inserting into an existing file. See the spec for more details.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Add rtf line to RTF file (From: email@hidden)

  • Prev by Date: Re: [ANN] Cocoa Developer Meeting Place
  • Next by Date: Re: NSScanner bug?
  • Previous by thread: Re: Add rtf line to RTF file
  • Next by thread: NSTextField width detection
  • Index(es):
    • Date
    • Thread