From: phil oakleaf on
Joseph M. Newcomer wrote:
> See below...
> On Thu, 11 Feb 2010 15:35:44 +0000, phil oakleaf <news(a)oakleafsoftware.co.uk> wrote:
>
>> Goran wrote:
>>> On Feb 11, 8:27 am, phil oakleaf <n...(a)oakleafsoftware.co.uk> wrote:
>>>> Does any one have ideas about creating well formatted tables to display
>>>> on a printed report.
>>> Aren't there reporting solutions from 0 to hero on Google? ;-)
>>>
>>>> The data is not in any standard database format and the number of rows
>>>> may be up to 200 so I'd need to paginate in some way.
>>> Paging is handled by any reporting tool, decent or not, I'd guess.
>>> Also, if you use system printing APIs yourself, you are forced to do
>>> it anyhow ;-)
>>>
>>>> Ideally, I'd like to use CString text to create an HTML table then
>>>> combine with CSS - but is there a way to use Internet Explorer to render
>>>> this into a Bitmap that I can drop on the page?
>>> You can certainly create HTML content in code, save it as file, and
>>> open it in your browser, css included. You can issue "print" shell
>>> command, too.
>>>
>>> If you want to display it inside your program, you can try to use
>>> IWebBrowser control, or better still it's MFC wrapper CHtmlView. I
>>> would guess that handles "Print" command, but I never tried.
>>>
>>> But whatever you do, DO NOT "RENDER INTO A BITMAP", though. World will
>>> thank you ;-).
>>>
>>> Goran.
>> From the start of MFC I have been generating my own reports using a
>> horrible hack of C++.
> *****
> I have a generic printing function that allows pagination and headings. You can find it
> on my MVP Tips site. However, it is not elegant, and is a sort of "line printer
> simulator".
> ****
>> What I'd like is a package that lets me defines 'objects' on a page
>> Tables, bitmaps etc. Give me full control over paper size and pagination
>> (seems to be a problem with HTML) and then generates a report that can
>> be previewed and printed.
> ****
> This is asking a lot. For example, HTML lets you define objects such as tables and
> bitmaps, but the placement is at the mercy of the HTML renderer, which can be a problem.
>
> You can look into things like rich edit control printing options, but they can be a pain
> to use.
>
> Note that if you set up your DC correctly, you can render anything you want onto a DC, but
> things like pagination are still your problem. For some kinds of reports, where you need
> to do "lookahead" to handle "grouping" on the same page, this can be a pain. There are
> report add-ins like Crystal Reports, but I've never needed to do this so never looked into
> them (they used to come with VS, but I don't know if they still do, for example)
>
> Note that there are no universally-suitable packages; some packages are really nice for
> recordset reporting, some are good for graphics rendering, but it gets tricky as you try
> to do everything.
> ****
>> I have Googled but if anyone here has experience of any packages or
>> techniques I'd be very appreciative.
>>
>> Why not "Render into a Bitmap"? :)
> ****
> Gigantic, resource hogs, limited capability (think about it: a 1200x1200 dpi printer needs
> 134 megapixels, and even if you only do B&W, this is a MASSIVE representation of
> information. Better to let the printer render it for you. Even 600x600 is
> 33Mpixels/page.
> joe
> *****
>> Phil
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
Joe

thanks as always for your infomative reply

From what you write it appears there's no real alternative to writing
my own reporting system if I need enough control.

I have looked at a system called HTMLCapture. which does what I want and
generates a good looking table - except for Pagination - However, I take
your point about the image size and will investigate that.


Thanks again
Phil

From: phil oakleaf on
Here's another HTML renderer I found that looks interesting


http://www.terrainformatica.com/htmlayout/
HTMLayout: fast, lightweight and embeddable HTML/CSS renderer and layout
manager component

It appears to be free as well

does anyone have experience with this?


Phil

From: David Wilkinson on
phil oakleaf wrote:
> Does any one have ideas about creating well formatted tables to display
> on a printed report.
>
> The data is not in any standard database format and the number of rows
> may be up to 200 so I'd need to paginate in some way.
>
> Ideally, I'd like to use CString text to create an HTML table then
> combine with CSS - but is there a way to use Internet Explorer to render
> this into a Bitmap that I can drop on the page?
>
> Many thanks for any replies

One way to go would be to write your data into XML. Then you could use XSL to
transform it into anything you want. That way, you have generality and the
formatting is separated from your C++ code.

Of course XSL has quite a learning curve...

--
David Wilkinson
Visual C++ MVP
From: Tom Serface on
I just did this for a project and I just wrote small routines to create the
HTML as needed in a string, then I write the string to a file every once in
a while (paging). I also created a CSS file and I just reference the
classes in the HTML I'm creating. That way I can change how the output
looks without having to change my code.

Fortunately, HTML is just text so it's easy to work with in strings and
files.

Tom

"phil oakleaf" <news(a)oakleafsoftware.co.uk> wrote in message
news:#WdwDvuqKHA.3800(a)TK2MSFTNGP06.phx.gbl...
> Does any one have ideas about creating well formatted tables to display on
> a printed report.
>
> The data is not in any standard database format and the number of rows may
> be up to 200 so I'd need to paginate in some way.
>
> Ideally, I'd like to use CString text to create an HTML table then combine
> with CSS - but is there a way to use Internet Explorer to render this into
> a Bitmap that I can drop on the page?
>
> Many thanks for any replies

From: phil oakleaf on
Tom Serface wrote:
> I just did this for a project and I just wrote small routines to create
> the HTML as needed in a string, then I write the string to a file every
> once in a while (paging). I also created a CSS file and I just
> reference the classes in the HTML I'm creating. That way I can change
> how the output looks without having to change my code.
>
> Fortunately, HTML is just text so it's easy to work with in strings and
> files.
>
> Tom
>
> "phil oakleaf" <news(a)oakleafsoftware.co.uk> wrote in message
> news:#WdwDvuqKHA.3800(a)TK2MSFTNGP06.phx.gbl...
>> Does any one have ideas about creating well formatted tables to
>> display on a printed report.
>>
>> The data is not in any standard database format and the number of rows
>> may be up to 200 so I'd need to paginate in some way.
>>
>> Ideally, I'd like to use CString text to create an HTML table then
>> combine with CSS - but is there a way to use Internet Explorer to
>> render this into a Bitmap that I can drop on the page?
>>
>> Many thanks for any replies
>
thanks for that - but how did you handle print / printPreview

did you just launch Internet Explorer to view the code.
Phil