Writing extremely large RTF or .doc files
Writing extremely large RTF or .doc files
- Subject: Writing extremely large RTF or .doc files
- From: Dave DeLong <email@hidden>
- Date: Fri, 17 Jun 2011 21:43:06 -0700
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?
Thanks,
Dave
_______________________________________________
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