Hello,
I have question regarding the method CreateReports. I develope in Delphi 7
and did the following to call the method (other methods before, like
CreateDatasource work successfully):
procedure TRepServWrapper.PublishRDLFile (const rdlname, rdlfile, parentPath
: String);
var
fs : TFileStream;
byteArray : TByteDynArray;
warnings : ArrayOfWarning;
i : Integer;
begin
fs := TFileStream.Create(rdlfile,fmOpenRead);
SetLength(byteArray,fs.Size + 1);
Try
fs.ReadBuffer(byteArray,fs.Size);
except on e:Exception do
raise ECouldNotOpenRDLFile.Create('TRepServWrapper.PublishRDLFile: ' +
errCouldNotOpenRDLFile + ': '+e.Message);
end;
fs.Free;
Try
warnings := FRSInt.CreateReport(rdlname,parentPath,True,byteArray,nil);
If Not (warnings = nil) Then
begin
for i := 0 to High(warnings)-1 do
SendDebug('Warnung beim Upload der RDL: '+ warnings[i].Message);
end
else
SendDebug('RDL erfolgreich geuploadet!');
except on e : Exception do
raise ECouldNotUploadRDL.Create('TRepServWrapper.PublishRDLFile: ' +
errCouldNotUploadRDL + ': ' + e.Message);
end;
end;
When I compile and run the application nothing happens after the line
warnings := FRSInt.CreateReport(...)..no error message, just nothing!
What could be the reason? Do I have to format the byte array in a different
way? I have seen that it has to be Base64 encoded...is this done
automatically? I took an Visual Basic example and adapted it to Delphi.Me again,
I have solved it: I created the byte array in a wrong way. It would be
correct in the following way:
fs := TFileStream.Create(rdlfile,fmOpenRead);
Try
Try
if fs.Size > 0 Then
begin
SetLength(byteArray, fs.Size);
fs.ReadBuffer(byteArray[0],fs.Size);
end;
except on e:Exception do
raise ECouldNotOpenRDLFile.Create('TRepServWrapper.PublishRDLFile: '
+ errCouldNotOpenRDLFile + ': '+e.Message);
end;
finally
fs.Free;
end;
No comments:
Post a Comment