comp.lang.ada
 help / color / mirror / Atom feed
* Prettty printed reports in MSWindows
@ 2003-05-01 22:32 Mark
  2003-05-02  1:14 ` tmoran
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Mark @ 2003-05-01 22:32 UTC (permalink / raw)


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




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  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-02 14:08 ` Fionn mac Cuimhaill
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: tmoran @ 2003-05-02  1:14 UTC (permalink / raw)


>How do others print out formatted reports with Ada?
  If your compiler implements Annex F you can easily do pretty fancy
numeric formating.  If not, you can still use Width and Fore, Aft, Exp
in the Ada.Text_IO routines.  Or do you mean playing with fonts and
colors and such?  (ie, are you printing information for internal use,
or propaganda for salesmen's use? ;)



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-02  1:14 ` tmoran
@ 2003-05-02 13:30   ` Mark
  2003-05-03 14:52     ` Marin David Condic
  0 siblings, 1 reply; 13+ messages in thread
From: Mark @ 2003-05-02 13:30 UTC (permalink / raw)


Using GNAT.  Unfortunately I do meant the fonts, lines, boxes maybe
shaded areas and such.  (So far we can leave out colors ... but, of 
course, that is subject to change.)

Mark


tmoran@acm.org wrote:
>>How do others print out formatted reports with Ada?
> 
>   If your compiler implements Annex F you can easily do pretty fancy
> numeric formating.  If not, you can still use Width and Fore, Aft, Exp
> in the Ada.Text_IO routines.  Or do you mean playing with fonts and
> colors and such?  (ie, are you printing information for internal use,
> or propaganda for salesmen's use? ;)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-01 22:32 Prettty printed reports in MSWindows Mark
  2003-05-02  1:14 ` tmoran
@ 2003-05-02 14:08 ` Fionn mac Cuimhaill
  2003-05-02 16:58   ` Pascal Obry
  2003-05-02 19:31   ` Randy Brukardt
  2003-05-02 14:31 ` David Botton
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Fionn mac Cuimhaill @ 2003-05-02 14:08 UTC (permalink / raw)


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.

There is a very nice ActiveX dll written in Visual Basic called
qPrinter (do a Google search and you will find it quickly) It is much
easier to use than the raw Windows API if you are using Visual Basic.
In principle, as it is an ActiveX dll, it can be called from GWindows.
I have no plans to use it myself this way, because it does have some
bugs and limitations that make it difficult to use for what I need to
do, but it may work for you. I have no idea how hard it would be to
call this from GWindows;

I am also considering writing output as TeX or LaTex and using a
Windows implementation of TeX, such as MikTeX to handle the details of
printing.

David Gressett
gxrxexsxsxextx1x@xaxixrxmxaxixlx.xnxext
Remove all instances of 'x' to get the e-mail address



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-01 22:32 Prettty printed reports in MSWindows Mark
  2003-05-02  1:14 ` tmoran
  2003-05-02 14:08 ` Fionn mac Cuimhaill
@ 2003-05-02 14:31 ` David Botton
  2003-05-02 16:06   ` Mark
                     ` (2 more replies)
  2003-05-03  8:25 ` Michal Morawski
  2003-05-03 16:35 ` Georg Bauhaus
  4 siblings, 3 replies; 13+ messages in thread
From: David Botton @ 2003-05-02 14:31 UTC (permalink / raw)
  To: comp.lang.ada

Here are three methods I commonly use (in this order):

1. I output to HTML
2. I use a program like Crystal Reports. The ActiveX controls works with
GWindows.
3. I create templates in WordPad (using %XXX% or the like for fields) and
save to RTF. Then I do search and replace with Ada on the fields so to speak
and send the results to WordPad for printing (you start the application with
the -p option and the filename and it just prints out the temp file).

David Botton


> However, I am currently trying to figure out a good way to print some
> formatted business reports.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  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
  2 siblings, 0 replies; 13+ messages in thread
From: Mark @ 2003-05-02 16:06 UTC (permalink / raw)


In my case option 3 will probably be the 'keeper'. HTML sounds 
interesting -- I'll have to see if I can get Iexplorer to print a 
document from the command line.

Thanks for the 'search and replace' comment, for some reason I hadn't 
considered it.

Mark


David Botton wrote:
> Here are three methods I commonly use (in this order):
> 
> 1. I output to HTML
> 2. I use a program like Crystal Reports. The ActiveX controls works with
> GWindows.
> 3. I create templates in WordPad (using %XXX% or the like for fields) and
> save to RTF. Then I do search and replace with Ada on the fields so to speak
> and send the results to WordPad for printing (you start the application with
> the -p option and the filename and it just prints out the temp file).
> 
> David Botton
> 
> 
> 
>>However, I am currently trying to figure out a good way to print some
>>formatted business reports.
> 
> 





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  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
  2 siblings, 0 replies; 13+ messages in thread
From: Pascal Obry @ 2003-05-02 16:57 UTC (permalink / raw)



"David Botton" <David@Botton.com> writes:

> Here are three methods I commonly use (in this order):
> 
> 3. I create templates in WordPad (using %XXX% or the like for fields) and
> save to RTF. Then I do search and replace with Ada on the fields so to speak
> and send the results to WordPad for printing (you start the application with
> the -p option and the filename and it just prints out the temp file).

Here you could use Templates_Parser, the parsing is already done and it has
more than just replace a tag by a string. See my homepage for
details. Templates_Parser is distributed with AWS too.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-02 14:08 ` Fionn mac Cuimhaill
@ 2003-05-02 16:58   ` Pascal Obry
  2003-05-02 19:31   ` Randy Brukardt
  1 sibling, 0 replies; 13+ messages in thread
From: Pascal Obry @ 2003-05-02 16:58 UTC (permalink / raw)



Fionn mac Cuimhaill <invisible@hiding.from.spam> writes:

> I am also considering writing output as TeX or LaTex and using a
> Windows implementation of TeX, such as MikTeX to handle the details of
> printing.

texinfo is maybe simpler to generate, you can also use the tetex Cygwin
package which works fine.

I would use a texinfo "templates" and use Templates_Parser to replace tags by
the corresponding values, then call tetex for the final rendering.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-02 14:08 ` Fionn mac Cuimhaill
  2003-05-02 16:58   ` Pascal Obry
@ 2003-05-02 19:31   ` Randy Brukardt
  1 sibling, 0 replies; 13+ messages in thread
From: Randy Brukardt @ 2003-05-02 19:31 UTC (permalink / raw)


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.









^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  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
  2 siblings, 0 replies; 13+ messages in thread
From: tmoran @ 2003-05-02 20:29 UTC (permalink / raw)


Windows approach is more or less to draw on a "screen", then print that
screen.  Which suggests that if the output is fairly random, that is, not
just rows and columns, it might make sense to use a GUI builder.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-01 22:32 Prettty printed reports in MSWindows Mark
                   ` (2 preceding siblings ...)
  2003-05-02 14:31 ` David Botton
@ 2003-05-03  8:25 ` Michal Morawski
  2003-05-03 16:35 ` Georg Bauhaus
  4 siblings, 0 replies; 13+ messages in thread
From: Michal Morawski @ 2003-05-03  8:25 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

You may use LaTeX and package lstlistins.

Reports look beautifil and it is easy to maintain them, package it is very
easy to use (of course when you are familiar with LaTeX)

-- 

############################################
## Michal Morawski
## 95-200 Pabianice, Sempolowskiej 5 m 13
## tel/fax ++48 42 2262228
############################################
Nigdy nie opieram sie pokusie, poniewaz przekonalem sie, ze rzeczy, kt�re mi
szkodza, nie kusza mnie.

"Mark" <no_no@dontspam.net> wrote in message
news:3EB1A07A.6050108@dontspam.net...
> 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
>





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-02 13:30   ` Mark
@ 2003-05-03 14:52     ` Marin David Condic
  0 siblings, 0 replies; 13+ messages in thread
From: Marin David Condic @ 2003-05-03 14:52 UTC (permalink / raw)


Unfortunately, that's not an Ada question - its a platform question. Ada -
and most other languages I know of - doesn't provide anything specific in
the standard as to how to do formatting of that sort of output. Its
impossible because it all depends on the output devices you're interested
in. Those devices might change on a weekly basis, so its hard to put
anything in the standard.

You could look at making your output in Postscript or HTML or XML or some
other appropriate plain-text markup and using tools after you have the
markup for post processing the documents. You have to look at what is
available on your platform to do that - or what you can reasonably get. But
beyond plain ASCII reports, there isn't much that is standard and supported
everywhere.

MDC
--
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/

Send Replies To: m c o n d i c @ a c m . o r g

    "Going cold turkey isn't as delicious as it sounds."
        -- H. Simpson
======================================================================

Mark <no_no@dontspam.net> wrote in message
news:3EB272FE.1030501@dontspam.net...
> Using GNAT.  Unfortunately I do meant the fonts, lines, boxes maybe
> shaded areas and such.  (So far we can leave out colors ... but, of
> course, that is subject to change.)
>
> Mark
>






^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Prettty printed reports in MSWindows
  2003-05-01 22:32 Prettty printed reports in MSWindows Mark
                   ` (3 preceding siblings ...)
  2003-05-03  8:25 ` Michal Morawski
@ 2003-05-03 16:35 ` Georg Bauhaus
  4 siblings, 0 replies; 13+ messages in thread
From: Georg Bauhaus @ 2003-05-03 16:35 UTC (permalink / raw)


Mark <no_no@dontspam.net> wrote:
: I am currently trying to figure out a good way to print some 
: formatted business reports.

We do that every day (though unfortunately only rarely with the help
of Ada programs).
Things to look at should, I think, include employing
XSL style sheets and XSL transformations, together with a formatting
backend.  (Or DSSSL, precursor to XSL(T).)
You produce a marked up data stream using some XML tags as markup,
and employ a style sheet producing high quality portable, printable
material.
(Several transformers and backends are available, some of them Free
Software, some of them proprietory sofware.)

You can do number formatting using Ada's COBOL facilities, or, to
an acceeptable extent, XSLT number formats, or both Editing and XSL.

Setting up a pipe to a DSSSL program might be an option too.
A well known program suite, Jade, can produce various output
formats, including RTF, TeX, HTML, and MIF.

In producing XML streams, AWS's template mechanism can help, but
you could as well extends your types with a suitable To_XML function,
and possibly combine the two.
If your reports will have mainly data set like items, that is, a sequence
of flat containers so to speak, producing XML data from them should be
straightforward. Otherwise, since XML documents are trees, you might
have to build adapters or some such.

If you are familiar with TeX, which according to Knuth (2000) was
conceived as a backend, you can again use AWS's templates to produce TeX
input; however, page breaking and the presence of inserts (footnotes,
running heads) and absolute positioning might cause some headaches. For
two years or so I have received invoices from a provider that were
automatically produced in that fashion. The results are comparatively
impressive (for invoices), due to the excellent paragraph breaking that
TeX does, hard to beat in particular using good fonts.

HTH, Georg

 

----------------------------------------------------------------
Georg Bauhaus                              bauhaus@futureapps.de
Future Apps GmbH                        http://www.futureapps.de
phone: +49 203 306 1560




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-05-03 16:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox