ppViewer change of content
Hi!
I have small app which I use to see report archive files. For that I have
browse like interface and on the right side TppViewer which represend
TppArchiveReader.
My problem is how to find out if raf file is OK 8by content) or how to see
if content of TppViewer has changed.
This is important because if user click on some word.doc file, TppViewr
doesn't show content but I need to get some event that current file is not
an RAF file?
I have tried with PageNumbers and so on but this is not OK. Status is very
often different than ''...
Please help,
--
Benjamin Vadas
P.S.
I have asked aboud EUR and RAF saving to database (EUR for RAF?)...so if
there is just one final respond...
;-)
I have small app which I use to see report archive files. For that I have
browse like interface and on the right side TppViewer which represend
TppArchiveReader.
My problem is how to find out if raf file is OK 8by content) or how to see
if content of TppViewer has changed.
This is important because if user click on some word.doc file, TppViewr
doesn't show content but I need to get some event that current file is not
an RAF file?
I have tried with PageNumbers and so on but this is not OK. Status is very
often different than ''...
Please help,
--
Benjamin Vadas
P.S.
I have asked aboud EUR and RAF saving to database (EUR for RAF?)...so if
there is just one final respond...
;-)
This discussion has been closed.
Comments
1. One simple check I can think of is to check that the file extension is
.raf, prior to setting the ArchiveReader.FileName property.
2. I looked at the ArchiveReader source code. It does not contain any logic
to check the content of the stream that is being read.
3. You could perhaps place a try/except around the call to
ArchiveReader.PrintToDevices.
--
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I do not follow...TppViewer can change picture (from something to white!)
but You can not find who do that?
THX!
On Tue, 20 Jul 2004 10:43:07 -0600, Nard Moseley (Digital Metaphors)
Perhaps I misunderstood the question. To clear the viewer try calling
myViewer.Reset;
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Reset method is ok...but it seems that when I click on some other file
(which has no valid RAF structure) the viewer is somehow white...so
ppViever know that this content cannot be show-because it is not a valid
RAF file.
Here is the code I use for that:
function TfrmRafRead.ShowClickedFile(aReportFileName:string):boolean;
begin
Result:=False;
with ppArchiveReader1 do begin
if FileExists (aReportFileName) then begin
ppArchiveReader1.Reset;
ArchiveFileName :=aReportFileName;
DeviceType := dtScreen;
PreviewFormSettings.WindowState:=wsMaximized;
PreviewFormSettings.ZoomSetting:=zsPageWidth;
try
ppArchiveReader1.PrintToDevices;
ppViewer1.RegenerateReport;
Result:= True;
except
end;
end;
end;
end;
But this function is allways true!!!
What is wrong?
THX!
I just created a simple example using RB 7.04.
1. I created an application that contains a single form.
2. On the form I placed a Viewer and an ArchiveReader.
3. I assigned the Viewer.Report to reference the ArchiveReader.
4. I added a button and implemented the OnClick event to show a file open
dialog and then call a method that contains the code you posted (see
belo3w).
5. This code works perfectly. If I open an invalid file, a blank page is
displayed by the Viewer.
6. If you would like to create a simple example that demonstrates the issue,
please send in zip format to support@digital-metaphors.com and we can check
it out...
Here is my code.....
procedure TForm1.Button1Click(Sender: TObject);
var
lsFileName: String;
begin
if ShowFileOpenDialog(lsFileName) then
PreviewArchive(lsFileName);
end;
function TForm1.PreviewArchive(aReportFileName:string):boolean;
begin
Result:=False;
with ppArchiveReader1 do begin
if FileExists (aReportFileName) then
begin
ppArchiveReader1.Reset;
ArchiveFileName :=aReportFileName;
DeviceType := dtScreen;
PreviewFormSettings.WindowState:=wsMaximized;
PreviewFormSettings.ZoomSetting:=zsPageWidth;
try
ppArchiveReader1.PrintToDevices;
ppViewer1.RegenerateReport;
Result:= True;
except
end;
end;
end;
end;
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com