Page 1 of 1

Problem with HTMLViewImporter

Posted: Fri Jul 06, 2012 11:35 am
by CyberMuth
Hello,

I have a problem with the htmlviewimporter.
I would like import a HTML File in the TRichViewEdit and i use the htmlviewimporter with the htmlviewer. The html includes pictures.

I use the following code:

Code: Select all

if OpenDialog1.Execute then begin
    HTMLViewer1.Base := OpenDialog1.FileName;
    HTMLViewer1.LoadFromFile(OpenDialog1.FileName);
    RVHTMLViewImporter1.ImportHtmlViewer(RichViewEdit1);
    NormalizeRichView(RichViewEdit1.RVData);
    RichViewEdit1.Format;
  end;
The pictures are in the same folder as the html file.
This is the image tag in the html-file:
<IMG alt="TS - Conditioned time signal" src="test.jpeg" width=640 height=390>

The problem is, I can't import the pictures in the richviewedit because I get a error. The importer use a wrong path for the image.

What can I do?

Posted: Fri Jul 06, 2012 11:37 am
by Sergey Tkachenko
Please send me this HTML with images to richviewgmailcom

Posted: Sat Jul 07, 2012 12:56 pm
by CyberMuth
i have send a email.

Posted: Sat Jul 07, 2012 2:32 pm
by CyberMuth
what is the right email adress???

Posted: Mon Jul 09, 2012 9:30 am
by CyberMuth
I have the problem solved.

Before import the HTML you must use the folowing code:

Code: Select all

SetCurrentDir(ExtractFilePath(m_sIndexHTMLPath));

Posted: Mon Jul 09, 2012 3:48 pm
by Sergey Tkachenko
Assigning
HTMLViewer1.BasePath := ExtractFilePath(OpenDialog1.FileName)
before loading must help.
Making the HTML file's directory current does not help if images are in subdirectory.