• 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: is printing tabular data really that annoying?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is printing tabular data really that annoying?


  • Subject: Re: is printing tabular data really that annoying?
  • From: email@hidden
  • Date: Thu, 25 Jan 2007 12:19:09 -0700

I didn't want to learn HTML to print tabular data. This is the approach I took.

Essentially, I have a separate invisible window with a copy of the displayed NSTableView nested inside a custom NSView called M''''''yPrintableBox. When M''''''yPrintableBox is asked if it knowsPageRange, it calculates the needed pages from the number of rows in the table. When asked for RectForPage it returns the bounds rect but saves the page number for use in the dataSource methods. The dataSource methods in M''''''yPrintableBox call the dataSource methods for the displayed table in M''''''yWindow to obtain the required data. Some NSTextField''''''s associated with the displayed table need to be duplicated in association with the invisible printed table, and these are updated by M''''''yWindow at the time M''''''yPrintableBox is passed to the print method in M''''''yDocument. Some code here was only used while I was testing the approach with the printable window set as being visible. Of course, an NSView could be used instead of an NSBox,

I like this approach because I can initially use the same Interface Builder NSTableView and the dataSource methods used for the displayed table. I expect I could later customize the printed table to improve it's printed appearance, but probably not as well as could be done with other approaches. This approach was sufficient for the simple program I used it for.

This message with code included got bounced because of length, so I'll just include a link:

http://forums.macrumors.com/showthread.php?t=273153


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: Any way to map a native window id back to an NSWindow?
  • Next by Date: Re: Core Data: Low level retrieving of data
  • Previous by thread: Re: is printing tabular data really that annoying?
  • Next by thread: Getting image info without loading entire image
  • Index(es):
    • Date
    • Thread