initializing path for end user template dialog box ?
Hello,
With your help (thanks for that !), I can now manage to allow my en-users to
create their own reports.
The last thing I would like to do is initializing the folder they are about
to save their reports into. But I don't know how to do that without changing
your code : I didn't see any event to help me, and found no documentation
about ReportLabelWizard...
Thanks for your help !
With your help (thanks for that !), I can now manage to allow my en-users to
create their own reports.
The last thing I would like to do is initializing the folder they are about
to save their reports into. But I don't know how to do that without changing
your code : I didn't see any event to help me, and found no documentation
about ReportLabelWizard...
Thanks for your help !
This discussion has been closed.
Comments
Thanks
after they have opened/loaded a report. This is a public event. You'll have
to assign it to an event handler in code. You'll also need to assign the
Report.Template.OnNew event. These are both TNotifyEvents.
Here is the code to do initialize the report to be pointing to a specific
folder, if you are using a query for the folder items. The SQL is just a
SELECT * FROM rbFolder on our main report explorer demo project.
procedure TmyEndUserSolution.NewReportEvent(Sender: TObject);
var
liID: Integer;
lsFolderName: String;
begin
ppReport1.OnPreviewFormCreate := PreviewFormCreateEvent;
Query1.First;
lsFolderName := Query1.FIeldByName('Name').AsString;
while (lsFolderName <> '01. AutoSearch') and not(Query1.EOF) do
begin
Query1.Next;
lsFolderName := Query1.FIeldByName('Name').AsString;
end;
if (Query1.EOF) then
begin
Query1.First;
liID := Query1.FIeldByName('FolderID').AsInteger;
end
else
liID := Query1.FIeldByName('FolderID').AsInteger;
ppReportExplorer1.CurrentFolderId := liID;
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
that it does not allows me to save my reports as simple Windows .RTM files,
but in databases (?)
What I would like to do is just initialize the folder of Save dialog box,
when end user click on "save to...", with :
- a specified windows folder
- a specified report name
I didn't found anything to do that : is it possible ?
Thanks,
Christophe
to save the reports to database if you are in the designer and choose Save.
There is an property on the designer that is AllowSaveToFile. You'll need to
set this in order to have two more file operations available in the File
menu of the report designer. There should be one for Save To File and Load
From File. Use these options in order to use file based templates.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
it allows to save .rtm file on disk, but my questions are :
- how to make the "save to" dialog box open on a specific folder ?
- how to set the default .RTM file name to a specific name (instead of a
blank name) ?
Thanks,
Christophe
I used and it worked in my tests.
2. To set the file path with a file name on the file save menu, simply set
the Report.Template.FileName property in the Report.Template.OnLoadEnd event
handler.
ppReport1.Template.FileName := 'C:\SomeDirectory\' +
ppReport1.Template.Description + '.rtm';
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
lWizard := TppLabelTemplateWizard.Create(Self);
lWizard.OnCreateReport := CreateReportEvent;
if Assigned(FReport) then
begin
FReport.Free;
FReport := nil;
end;
if (lWizard.Execute) then
begin
{add code here to create the layout}
AddComponentsToDetail(FReport);
ppdesigner1.Report := FReport;
ppDesigner1.ShowModal;
and here the code of CreateReport event :
FReport := TppReport.Create(Self);
{Before launching the label wizard the user needs to choose a datapipeline
for
this label template wizard from a selection of choices that you have
given
them.}
FReport.DataPipeline := ppJITPipeline;
FReport.Template.OnLoadEnd := OnLoadEnd;
aReport := FReport;
When this is executed, OnLoadEnd event is never fired, so... what am I
supposed to do ?
Thanks,
Christophe
event never fires...
tries to save itself, it will point to the filepath + filename in the save
dialog.
As far as the OnLoadEnd event not firing, that should not be the case,
because it should fire when a report is loaded by the user. Otherwise, you
should use the Report.Template.OnNew event when a new report is created.
Perhaps this is the case. Use the OnNew and see if that helps. Are you
using this example as a base project?
http://www.digital-metaphors.com/tips/LaunchLabelWizardInCode.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
template event (not documented).
here is what I've done, and it works as I want...
procedure TForm1.MyCreateDialog(Sender, dialog: TObject);
begin
if Assigned(Dialog) and (Dialog is TSaveDialog) then
begin
TSaveDialog(Dialog).FileName := 'MyTemplateName';
TSaveDialog(Dialog).InitialDir := 'c:\MyFolder\';
....
end;
end;
...
FReport.Template.OnCreateDialog := MyCreateDialog;
...
Anyway, thanks for your help Jim !