Print Preview Dialog with ability to select lables to print?
Greetings,
You see the print dialogs for programs like Avery DesignPro Software that
willl show you a thumbnail version of your page with labels that allow you
to select the labels you want to print for time when you do not have a full
page of labels to print. Has anyone done anything like this using
ReportBuilder?
If so, I need to add this ability to my program where the user can select
with the mouse which labels to print.
Something like this, where S = Skip and P = Print
S S S
S S S
S P P
P P P
P P P
P P P
or like this
P S S
P S S
P S S
P S S
P S S
P S S
Any help appreciated.
--
Michael Tuttle
Software Technologies, Inc.
Topeka, KS
You see the print dialogs for programs like Avery DesignPro Software that
willl show you a thumbnail version of your page with labels that allow you
to select the labels you want to print for time when you do not have a full
page of labels to print. Has anyone done anything like this using
ReportBuilder?
If so, I need to add this ability to my program where the user can select
with the mouse which labels to print.
Something like this, where S = Skip and P = Print
S S S
S S S
S P P
P P P
P P P
P P P
or like this
P S S
P S S
P S S
P S S
P S S
P S S
Any help appreciated.
--
Michael Tuttle
Software Technologies, Inc.
Topeka, KS
This discussion has been closed.
Comments
It should be possible to create a dialog before the report is loaded that
loops through each component in your report and gives your users the ability
to print them or not. If you are loading your reports from templates, you
will want to use the OnLoadEnd event to loop through each report component.
If you are loading a report on a form, simply load the dialog just before
Report.Print is called.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'm still a little new to ReportBuilder and do not know how I could show a
graphical representation of a page layout on the print dialog and further
how I could allow the user to select from this graphical representation to
print selected labels and lastly how the printer would actually know to
print the selected labels. Are there any examples available on how to
accomplish this? If not, would it be possible to pay someone to help out on
this as the deadline for our project is approaching fast.
Thanks
Mike
Depending on how sophisticated you need this to be, it shouldn't be too
difficult to implement. From what I can gather (and correct me if I'm
wrong) you would like a dialog to show up before the user prints/previews a
report that allows that user to choose which fields will be printed on the
report. All you would need to do in this case is loop through the report
components and display the field names corresponding to a dbText in your
report for your users to select or de-select. Then based on their
selection, you could toggle the visibility of those components. Below is an
article on creating a Report Object Loop.
If you want to give the user the ability to choose which records get
printed, you will need to create something a bit more complicated. I would
approach this by creating a TList of objects that contain information about
each record. At a minimum you will need to know the Field name, Row number
(tuple), and visibility status (whether the user wants it to show up or
not). These objects would all need to be created before the report is
printed. Then in the DetailBand.BeforePrint event, you could loop through
the TList and check to see if any of the dbTexts need to be set Visible :=
False.
Note: Check out the Tech-Tips newsgroup for more helpful articles on using
ReportBuilder...
----------------------------------------------
Tech Tip: Loop Thru All Objects in a Report
---------------------------------------------
A ReportBuilder report is composed of a set
of components. The basic structure is
Reports.Bands[].Objects[]
The bands and objects within the report can
be accessed directly by object name or
via the Bands and Objects array properties.
Below is an example of using the Bands and
Objects array properties to change the font for
all objects on a report.
uses
ppClass;
procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont then
lObject.Font := aFont;
end;
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I think you have misunderstood the question so I'll try once again. My user
are printing labels for cassette tapes and on the print dialog, I want to
add a graphical representation of the layout for these cassette tape labels
showing 2 labels wide and 6 labels high. From this graphical layout I need
to allow the user to select which cassette tape labels will be printed, so
let's say the last time they printed these labels they have a sheet of AVERY
labels with 3 labels left on it. I want to allow them to take their mouse
and select the last three cassette labels left on this sheet and print them.
Am I making any sense yet? If you look at any label printing programs
(Mailing labels, cassette tapes, VCR Tapes, etc), they have this capability.
For instance, the AVERY DesignPro Software has this feature. I need to add
this capability to the print dialog when using ReportBuilder.
Any tips appreciated.
Mike
Sorry about that. Check out the following example by clicking on the link
below. This example loads the Label Wizard automatically in code before
printing the report. You could do something similar or you could replace
the current print dialog to incorporate these type of options.
http://www.digital-metaphors.com/tips/LaunchLabelWizardInCode.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com