• 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: Writing extremely large RTF or .doc files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing extremely large RTF or .doc files


  • Subject: Re: Writing extremely large RTF or .doc files
  • From: Charles Srstka <email@hidden>
  • Date: Sat, 18 Jun 2011 11:14:16 -0500

On Jun 17, 2011, at 11:43 PM, Dave DeLong wrote:

> Hey List,
>
> I'm writing a little app for myself to take a database full of text and format it into either a Word Document or an RTF document (either one is fine for my purposes).  I've got it working for small datasets, but I'm running in to performance issues when trying to generate files larger than a couple of megabytes.
>
> Ideally, I'd like to create my thousands and thousands of NSAttributedStrings, convert them to NSData objects, and stream them out to disk.  Unfortunately, the APIs in AppKit require me to build a single NSAttributedString and convert it into an NSData all at once; no streaming is possible.  For my purposes, this is impractical because of the memory implications of keeping tens of thousands of NSAttributedStrings alive for the duration of the generation process.
>
> The only thought I had to work around this was to generate my RTF data and strip out the document-level attributes before streaming it out to disk.  Barring a superior solution, I'll end up doing this.
>
> I surely can't be the first person to want to do  this, so I ask: what have I missed?  How can I generate extremely large rich-text files without having to build the entire file in memory before writing it out?

Have you considered breaking this file up into a series of smaller files instead? If the flie is sufficiently large that it is impractical to hold it all in memory while writing it, you may just end up causing problems for applications that load the entire file into memory while *reading* it (as, I believe, TextEdit does).

Charles_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Writing extremely large RTF or .doc files (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)
  • Next by Date: Re: So... we can't use UIWebView (with a delegate) on a page that's pushed onto a UINavigationController stack?
  • Previous by thread: Re: Writing extremely large RTF or .doc files
  • Next by thread: Re: Writing extremely large RTF or .doc files
  • Index(es):
    • Date
    • Thread