Previewing html
Posted: Mon Mar 13, 2006 8:51 pm
Hi,
I am evaluating a demo version of trichedit. I have an import function that allows the user to import a .mht file, which then extracts the .mht into html with sub dirs for images.
When I programmatically open the html file in trichedit (after the import is complete) the images do not load. However, If I then manually use the Open dialog using richviewactions, the html file loads fine and the images are displayed correctly.
I am using the same code for both operations (both import and open):
----------------------------BEGIN CODE SNIPPET-----------------------------
function TfrmMain.LoadHTMLFile(aHTMLFileName : string; aRichViewEdit : TCustomRichViewEdit) : boolean;
var
Stream : TFileStream;
s : String;
begin
try
Stream := TFileStream.Create(aHTMLFileName, fmOpenRead);
try
SetLength(s, Stream.Size);
Stream.ReadBuffer(PChar(s)^, Length(s));
finally
Stream.Free;
end;
RvHtmlImporter1.RichView := aRichViewEdit;
RvHtmlImporter1.LoadHtml(s);
fLastOpenedFile := aHTMLFileName;
result := True;
except;
result := False;
end;
end
------------------------END CODE SNIPPET----------------------------------
Can you help me figure out why the file is not rendering after an import, but does render correctly after an open?
Thank you in advance,
Shaune
I am evaluating a demo version of trichedit. I have an import function that allows the user to import a .mht file, which then extracts the .mht into html with sub dirs for images.
When I programmatically open the html file in trichedit (after the import is complete) the images do not load. However, If I then manually use the Open dialog using richviewactions, the html file loads fine and the images are displayed correctly.
I am using the same code for both operations (both import and open):
----------------------------BEGIN CODE SNIPPET-----------------------------
function TfrmMain.LoadHTMLFile(aHTMLFileName : string; aRichViewEdit : TCustomRichViewEdit) : boolean;
var
Stream : TFileStream;
s : String;
begin
try
Stream := TFileStream.Create(aHTMLFileName, fmOpenRead);
try
SetLength(s, Stream.Size);
Stream.ReadBuffer(PChar(s)^, Length(s));
finally
Stream.Free;
end;
RvHtmlImporter1.RichView := aRichViewEdit;
RvHtmlImporter1.LoadHtml(s);
fLastOpenedFile := aHTMLFileName;
result := True;
except;
result := False;
end;
end
------------------------END CODE SNIPPET----------------------------------
Can you help me figure out why the file is not rendering after an import, but does render correctly after an open?
Thank you in advance,
Shaune