Re: How are you creating reports on file (viewable)?
From: Jase (jshelley_at_nospam.optushome.com.au)
Date: 04/10/04
- Next message: J Newbill: "How to Modify Default Button for Property***?"
- Previous message: Jeff Partch [MVP]: "Re: Problems Detecting if Themes are Active"
- In reply to: Charles C.: "How are you creating reports on file (viewable)?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Apr 2004 11:12:23 +1000
"Charles C." <binstar@aei.ca> wrote in message
news:Ow1ylxlHEHA.2720@TK2MSFTNGP11.phx.gbl...
> I would like to know from whoever is creating reports on file (viewable)
> what methods they are using?
>
> Presently I am either writing plain reports to text files or when
formatting
> and shapes such as rectangles are required, I am using RTF files. RTF
> files are cumbersome to work with and very time consuming.
>
> I am looking for alternatives that do not require 3rd party software.
>
> Thanks,
> Charles.
>
>
Here's how I do it. It is part of a system that automates the reporting of
lab tests.
* Everything on the page is defined as an object of some kind, whether
that be a text box, image, table, etc. Each object has it's own class
derived from a base class I called CPageLayoutObject. Each class handles
it's own data and rendering. The rendering function is a pure virtual
function in the base class, so that a list of CPageLayourObject(s) can be
utilized.
* I have written a page layout editor, which makes the placement of said
objects much like most desktop publishing apps (without most of the
features).
* When saving the page, each object is called in turn to serialise its
data, which it does in an xml format, to maintain backward compatability and
extendability for the future. I first write the data to a memory file, then
compress that to a disk file, mostly to prevent hand editing in the final
product. Tuning the compressor to the current file tags can increase your
compression, and the addition of future tags won't have a large effect, so
long as the compressor is still adaptive.
* It is easy enough to hand code the page layout, as I had to do for a
while as the report generator needed to be completed before the editor. A
simple text editor with the additional feature of decompressing input and
compressing output was required, but that is a 1 minute job using the app
wizard.
* Text objects (text boxes, tables, etc) have the ability to store their
data as a query rather than as static text. That query could be an SQL query
on a database that is defined somewhere in the file, or a more targeted
approach, using other data objects that you have written.
As is so often the case in vc++, to deviate slightly from the norm can
increase the effort required exponentially. A simple clunky method is often
available, and is entirely up to you as to how far you want to go. Writing a
report generator is a fairly simple task, and if you have a limited number
of forms to print, then hand coding those won't take long. Writing the
printing part is very simply if your objects each take care of their own
rendering. Your OnDraw function can be as little as two lines:
pDC->SetMapMode(MM_HIMETRIC);
for (int i = 0; i < m_nObjectCount; i++) m_listObjects[i]->Render(pDC);
Good luck :-)
Jase
- Next message: J Newbill: "How to Modify Default Button for Property***?"
- Previous message: Jeff Partch [MVP]: "Re: Problems Detecting if Themes are Active"
- In reply to: Charles C.: "How are you creating reports on file (viewable)?"
- Messages sorted by: [ date ] [ thread ]