List index out of bounds (0) Exception using TExtraDevices
Hi:
I am trying to create a PDF ReportStream using ReportBuild 6.02 and
TExtraDevices.
I got the above error without the TExtraOptions component on my WebModule.
If I add the component to my WebModule, then I got EClassNotFound Exception.
The following is my code:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := PDF_Report;
Response.ContentType := 'application/pdf';
Response.SendResponse;
Handled := True;
end;
function TWebModule1.PDF_Report: string;
begin
with ppReport1 do
begin
DeviceType := 'PDFFile';
if Publisher.Devices[0].InheritsFrom(TExtraDevice) then
(Publisher.Devices[0] as TExtraDevice).PrintToStream := True;
end;
OraSession1.Open;
OraQuery1.Open;
ppReport1.Print;
with (ppReport1.Publisher.Devices[0] as TExtraDevice).ReportStream do
begin
SetLength(Result, Size);
Read(Pointer(Result)^, Size);
end;
end;
Can someone tell me what I have done wrong?
TIA,
Ping Kam
I am trying to create a PDF ReportStream using ReportBuild 6.02 and
TExtraDevices.
I got the above error without the TExtraOptions component on my WebModule.
If I add the component to my WebModule, then I got EClassNotFound Exception.
The following is my code:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := PDF_Report;
Response.ContentType := 'application/pdf';
Response.SendResponse;
Handled := True;
end;
function TWebModule1.PDF_Report: string;
begin
with ppReport1 do
begin
DeviceType := 'PDFFile';
if Publisher.Devices[0].InheritsFrom(TExtraDevice) then
(Publisher.Devices[0] as TExtraDevice).PrintToStream := True;
end;
OraSession1.Open;
OraQuery1.Open;
ppReport1.Print;
with (ppReport1.Publisher.Devices[0] as TExtraDevice).ReportStream do
begin
SetLength(Result, Size);
Read(Pointer(Result)^, Size);
end;
end;
Can someone tell me what I have done wrong?
TIA,
Ping Kam
This discussion has been closed.
Comments
solved the EClassNotFound problem. Maybe it work to you too.