New features in version 2.1
PrintGrid user interface now available in Italian (Courtsey of Fabio Demaria)
1. Support for Cell Graphics in the Grid being printed. The visible portion of cell pictures can now be printed along with the text content. All cell picture alignments are supported.
2. Printing of a program defined selected area (irrespective of any user grid cell selection) is now possible via the API. This is intended to support the use of MsFlexgrids as interactive spreadsheets.
3. A section of text lines can now follow the page title. Lines of text can be displayed as a sub-title or as a description/introduction to the output. These lines have their own font and justification settings. This feature is not available from the user dialogue (who wants yet another tab?) but only via the API.
Minor Changes
PrintGrid now attempts to detect printers that do not support multiple copies and disables the copies option where appropriate.
Selecting to show cell background colours now works even when the grid line printing has not been selected.
Full control over the title font is now available from the user dialogue or via the API (the original API control over limited title font settings is still supported for backwards compatibility). The dialogue now displays the title using the selected font. This also cleared up a minor bug in the user dialogue.
Compressed print now supports an optional proportional compression mode that ensures that horizontal and vertical compressions are the same. This improves the presentation of compressed grids that include cell graphics.
Plus some minor improvements to the overall code efficiency.
Introduction
Grid Controls (and in particular the
MsFlexGrid control of VB6) have proven themselves to be very effective for report output.
But what do you do if your users still insist upon printed paper output? Some custom
controls available (at a price) provide printing facilities but you can add flexible and
controllable printed output to any grid.
The full source code
for our grid printing solution is available for free download under the GNU Lesser Public License. So, feel free to download the code
and add it to your next project or software product. Your users will love the printing
facilities provided.
The design
objectives:
- To retain programmer
control over the print options presented to the user at run time.
- To allow large grids to
be printed
- By printing multiple
pages to support the grid width as well as length
- By allowing the user or
programmer to elect to compress the output
- By printing multiple
grid sections on a single page
- To print or suppress
grid lines
- To support merged cells
and to skip hidden columns or rows
- Give the user access to
all available printers and stationary options
- Provide support for
formatted text and cell background colours
- Provide support for
page titles, column and row headings
- Allow the user to print
a selected area of the grid or selected pages from the report.
- Provide support for
column and cell text alignments
Well that is where it started but a lot has happened since then
thanks to the ideas and code contributions of the world wide users of
PrintGrid.
Why is it all on a
form?
The answer is
simplicity. No ActiveX DLLs or OCX controls to worry about installing and no worries
about version control. You just append the PrintGrid form to your project to gain top
quality printed output for your program users. Plus - you get access to the source code so
you can add your own tweaks or special facilities. A form exhibits most
of the properties of a VB class although frustratingly one or two useful
features are missing - now if we had the planned VB7 rather than VB.NET
the holes would have been filled.
What do you have to
do?
Just append the form
to any project that displays data in an MsFlexgrid. You can then call the methods exposed
by the form to print the grid contents. The Application Programming Interface (API)
provides the programmer with almost complete control over the output layout or he or she
can leave it to the user to pick the best print options from the dialogue box at run time.
The downloadable zip
file contains full current documentation for the API in an RTF file but you can browse the older HTML version by clicking here or download
a copy in MS Word 2000
format or read the PDF file
version. This should give you a good
insight into the hidden capabilities of this fantastic module.
Not Using the
MsFlexgrid Control?
If you are using other
grid controls or have no need to display the intended output to the user before printing
it then copy the text into an invisible MsFlexgrid control placed on your form, set the
API properties that suite you and call the PrintGrid method.
How to get the code
You can download the
code the code for version 2.1 here
Please take a look at the license if you are unfamiliar with it and remember that we retain the copyright on the code. Neither the license nor our copyright ownership should
restrict your usage of the code unduly - they are intended to stop you simply repackaging
the code and selling it on as a product in itself. If you do make changes or improvements
to the code then you should make these changes available to others. The simplest way of
achieving that end would be to pass the details back to us so we can make your
enhancements available through these pages. If you come across any bugs then please let us
know - we will try to fix them and post the revised code and bug list here. Please contact
Mike@adit.co.uk with revisions, bugs and suggestions.
This is the final version of the VB6 PrintGrid module - allowing for bug
fixes of course.
The Future
We are
considering a .NET equivalent to PrintGrid. Your ideas, suggestions or code contributions are always very welcome.
|