Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

problem w/rich text when running as a Windows Service

edited October 2003 in General
Hi,
I have a reporting application that I can compile as either an
Application or a Service. The reporting application runs on a server
and clients send requests for reports via IP and get the report back as
a stream that contains an ArchiveFile. Everything worked fine until I
tried to use a RichText on a report. When the reporting server is run
as an application it works fine with RichText, but when I run it as a
Service, it prints the report correctly the first time, but after that
it will either not print the RichText components or it will just print
the first line and then add weird page breaks. I can't figure out why
there would be a difference between running it as an App or a Service.

Here is some simplified code of what I do. Each time a report is
requested, I do the following within a thread:

ReportForm:=TReportDM.Create(nil); //TReportDM contains datasets and
//pipelines and Report
Try
ReportForm.Initialize; //determines report to run and
//populates datasets with data for report
Rpt.Reset; //Rpt is the TppReport component
Rpt.Template.DatabaseSettings.Name :=
ReportsTable.FieldByName('Name').asString;
Rpt.Template.LoadFromDatabase;
Rpt.AllowPrintToArchive:=True;
Rpt.DeviceType:='ArchiveFile';
Rpt.ArchiveFileName := TempPath+'Rpt'+IntToStr(GetCurrentThreadID);
Rpt.ShowCancelDialog:=False;
Rpt.ShowPrintDialog:=False;
Try
Rpt.Print;
sp.WriteFile(Rpt.ArchiveFileName,rptID+'.rpt'); //saves archive
//file to a stream that is sent back to client
Finally
DeleteFile(Rpt.ArchiveFileName);
end;
Finally
ReportForm.Free;
end;


Thanks for any clues you might have,
Kevin

Comments

This discussion has been closed.