From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Prettty printed reports in MSWindows
Date: Fri, 2 May 2003 14:31:21 -0500
Date: 2003-05-02T14:31:21-05:00 [thread overview]
Message-ID: <vb5hqolq77ov66@corp.supernews.com> (raw)
In-Reply-To: 05u4bvkvvh6r048psivlsa09fs90atisfp@4ax.com
Fionn mac Cuimhaill wrote in message
<05u4bvkvvh6r048psivlsa09fs90atisfp@4ax.com>...
>On Thu, 01 May 2003 17:32:26 -0500, Mark <no_no@dontspam.net> wrote:
>
>>I'm not used to working in MSWindows, and I'm not used to printing
paper.
>>
>>However, I am currently trying to figure out a good way to print some
>>formatted business reports. So far it looks like I could write the
data
>>in RTF format and get Notepad to do the printing. Or I could write it
>>out in PS and use ghostscript ... maybe use groff to create the
>>postscript?
>>
>>How do others print out formatted reports with Ada?
>>
>>Mark
>
>Sigh. I am in exactly same position. I am using David Botton's
>GWindows to do Windows programming in Ada. It has printing support
>that will handle all the font control that you would want to do, but
>it is a very thin binding that is still very close to the underlying
>Windows printing API, i.e., using it to produce a usable document is a
>very tedious business.
On shortcut is to use the printing facilities included in the Rich Edit
control. I don't know about GWindows, but the full Claw has a binding to
that which makes it pretty easy. The basic idea is to load your output
text into a Rich Edit control (which supports fonts and colors, etc),
then print it. For instance, to print the context of a Rich Edit control
with 1 inch margins, the pseudo code would look like:
-- Selection : Claw.Edit.Selection_Type;
-- Last : Claw.Edit.Character_Index_Type;
-- Printer : Claw.Canvas.Printer_Canvas_Type;
-- begin
-- -- Create an approriate printer, and call Start_Document.
-- Selection := (First => 1, Last =>
Last_Character_Index(Edit));
-- loop
-- Claw.Canvas.Printer.Start_Page (Printer);
-- -- Render any headers or footers here.
-- Print_Range (Edit, Last, Printer,
-- Margins => (1440, 1440, 1440, 1440),
-- Format_Selection => Selection);
-- Claw.Canvas.Printer.End_Page (Printer);
-- exit when Last >= Selection.Last;
-- Selection.First := Last;
-- end loop;
-- Finish_Format (Edit);
-- Claw.Canvas.Printer.End_Document (Printer);
-- end;
(This is from the Claw comments.) There is a working example in the Claw
examples.
I'd expect something similar to work with GWindows.
Randy Brukardt.
next prev parent reply other threads:[~2003-05-02 19:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-01 22:32 Prettty printed reports in MSWindows Mark
2003-05-02 1:14 ` tmoran
2003-05-02 13:30 ` Mark
2003-05-03 14:52 ` Marin David Condic
2003-05-02 14:08 ` Fionn mac Cuimhaill
2003-05-02 16:58 ` Pascal Obry
2003-05-02 19:31 ` Randy Brukardt [this message]
2003-05-02 14:31 ` David Botton
2003-05-02 16:06 ` Mark
2003-05-02 16:57 ` Pascal Obry
2003-05-02 20:29 ` tmoran
2003-05-03 8:25 ` Michal Morawski
2003-05-03 16:35 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox