default printer not sticking
RB 5.56, Delphi 5 plus Upgrade, HP LaserJet 1100, Dymo LabelWriter 320 Label
Printer, Windows XP Pro, Simple filesharing disabled.
1st station owns the label printer whose name is "dymo"
2nd station maps to \\stn1\dymo
3rd station maps to \\stn1\dymo
The HP printer is the default on all three stations. When I edit the report
template using the designer it accepts setting the default printer under
page/setup to the \\stn1\dymo and sticks at that setting until I move to
another station and try to edit it... At this point it changed the default
in report builder to the HP. This is causing 1000's of labels to spool to
the printer and is causing my clients to scream at me for a solution. This
change of printer defaults occurs both between stn1 and either stn2 or stn3
and/or stn2 and station 3 both of which have the same name \\stn1\dymo.
Any help would be muchly appreciated.
Dayna.
Printer, Windows XP Pro, Simple filesharing disabled.
1st station owns the label printer whose name is "dymo"
2nd station maps to \\stn1\dymo
3rd station maps to \\stn1\dymo
The HP printer is the default on all three stations. When I edit the report
template using the designer it accepts setting the default printer under
page/setup to the \\stn1\dymo and sticks at that setting until I move to
another station and try to edit it... At this point it changed the default
in report builder to the HP. This is causing 1000's of labels to spool to
the printer and is causing my clients to scream at me for a solution. This
change of printer defaults occurs both between stn1 and either stn2 or stn3
and/or stn2 and station 3 both of which have the same name \\stn1\dymo.
Any help would be muchly appreciated.
Dayna.
This discussion has been closed.
Comments
I assume you are setting the Report.PrinterSetup.PrinterName property inside
your report before you save the template. This is a very unreliable method
to use when switching machines, operating systems, etc. The template will
store the acutal printer name installed on the original computer. These
names tend to vary slightly from machine to machine. My suggestion would be
to use the OnLoadEnd Event of the Template to assign the correct printer
manually using the Report.PrinterSetup.PrinterNames string list. The
article below shows how to access the template events.
----------------------------------------------
Tech Tip: Using Template Events
----------------------------------------------
The Report.Template object has several events that can be used for
customizing what happens when a report is loaded or saved:
- OnLoadStart
- OnLoadEnd
- OnNew
- OnSaveStart
- OnSaveEnd
The OnLoadEnd and OnNew events are often used to perform actions related
to report and data initialization.
The OnSaveEnd event is often used to save additional descriptive
("meta") data to the database each time the report is saved.
Example:
The Report.Template events are public and therefore must be assigned at
run-time.
1. In the private section of your form declaration you can declare an
event-handler method:
TForm = class(TForm)
private
procedure myTemplateOnLoadEndEvent(Sender: TObject);
public
end;
2. In the Form.OnCreate event, you can assign the event-handler to the
event:
procedure TForm1.FormCreate(Sender: TObject);
begin
ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;
end;
3. Implement the event-handler method:
procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
begin
{add code here to initial the report or data, etc. }
ppReport1.PrinterSetup.MarginTop := 0.5;
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I let the client set the default printer using the File/Page Setup menu item
in the designer. I do not by added code change anything in the template.
Until XP this procedure has worked just fine so long as the share name and
printer name were the same (case sensitive). This is no longer true under
XP.
I'm gonna try to implement what you suggested, but frankly it went mostly
over my head as to how it would help.
Dayna.
Sorry, in my first response I was making a few assumptions. If you are
allowing your users to change the printer settings manually, there should be
no need to do any of the things I mentioned below. This is however not a
known issue with ReportBuilder. My suggestion would be to download a trial
version of ReportBuilder 7.03 and test with that. If the problem still
persists, please send me an example that recreates the problem and I'll try
in on my machine here. Send the example to support@digital-metaphors.com.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com