From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8cc649f593606ebf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-02 12:30:33 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Prettty printed reports in MSWindows Date: Fri, 2 May 2003 14:31:21 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3EB1A07A.6050108@dontspam.net> <05u4bvkvvh6r048psivlsa09fs90atisfp@4ax.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:36884 Date: 2003-05-02T14:31:21-05:00 List-Id: Fionn mac Cuimhaill wrote in message <05u4bvkvvh6r048psivlsa09fs90atisfp@4ax.com>... >On Thu, 01 May 2003 17:32:26 -0500, Mark 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.