Problem with HTMLViewImporter

General TRichView support forum. Please post your questions here
Post Reply
CyberMuth
Posts: 8
Joined: Fri Jul 06, 2012 11:18 am

Problem with HTMLViewImporter

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send me this HTML with images to richviewgmailcom
CyberMuth
Posts: 8
Joined: Fri Jul 06, 2012 11:18 am

Post by CyberMuth »

i have send a email.
CyberMuth
Posts: 8
Joined: Fri Jul 06, 2012 11:18 am

Post by CyberMuth »

what is the right email adress???
CyberMuth
Posts: 8
Joined: Fri Jul 06, 2012 11:18 am

Post by CyberMuth »

I have the problem solved.

Before import the HTML you must use the folowing code:

Code: Select all

SetCurrentDir(ExtractFilePath(m_sIndexHTMLPath));
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply