Report printing
Report printing
- Subject: Report printing
- From: Beat Koch <email@hidden>
- Date: Thu, 20 Nov 2003 13:25:53 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have to print a report of one or more pages. Each page contains a
header followed by a variable amount of rectangles which contain the
data of a record. I've read all the available documentation on printing
and I have set up an NSView subclass for printing. According to the
documentation, I have to implement drawRect to do my output and this
also works.
Now I'm a bit lazy and I'd prefer to have a graphical tool to layout
the fields of the header and of the records instead of hard-coding
every text output. So I have created a nib file which contains small
custom views, one for the header and one for records. The idea is that
my PrintView loads this nib, places the views correctly and they get
printed automatically when print: is called. In pseudo-code, this is
what I hope to do:
- - drawRect (of PrintView)
{
compute and set the frame of HeaderView
set text fields of HeaderView with general information
display HeaderView
for each record that I want to print do
compute and set the frame of RecordView
set text fields of RecordView with record information
display RecordView (by calling -display or by directly calling
- -drawRect of RecordView)
end for
}
I'd like to have only one instance of RecordView which I can reuse as
many times as necessary in drawRect. Now... If I add HeaderView as
subview to PrintView, then it really gets printed. If it's not a
subview of PrintView, no output is generated. Question 1: Why is this?
Can I avoid having to attach HeaderView and RecordView to PrintView and
still get an output on paper?
Problem 2: The record-displaying part does not work. Only the last
record at the last position is printed on the page. Do I really have to
instantiate RecordView for every record? If so, is there a better way
to do it than to reload the nib for every new instance? Can I somehow
copy a view (NSView does not implement the NSCopying protocol, as far
as I've seen)?
Thanks for any help!
Beat
PS: Does anybody know a Cocoa reporting tool?
- -----
Beat Koch Informatik, Im Taeli 8, CH-3052 Zollikofen, Switzerland
Phone: +41 (31) 914 23 51, Fax: +41 (31) 914 23 52
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBP7yy0ezksbVDbluoEQLeVwCeIXdO7LwDv1WR4f8PL5gXx5yCRTgAn38x
TOYDo6tQXUaWGQB8X4+pA5qg
=8oVn
-----END PGP SIGNATURE-----
_______________________________________________
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.