Solved

HTML Preview

Posted on 2009-05-06
8
459 Views
Last Modified: 2012-05-06
Hi all,

I have a project where I've inserted a page tab.
On one tab I have a tab with synedit component where I have the html code.

Now I tried adding EmbeddedWB but the preview was not displying properly as it's got css etc.

So, I was thinking of trying TBrowser? or someother if you know of a better component to use.

To basically I have the code on one tab and when I go the tabsheet2 I need to get the browser component to display the html page.

How is the best way to do this please?

thanks

st3vo
0
Comment
Question by:ST3VO
  • 6
  • 2
8 Comments
 
LVL 8

Assisted Solution

by:BdLm
BdLm earned 50 total points
ID: 24312573
use the TWebbrowser , TWebbrowers.navigate(myfile.html)

0
 

Author Comment

by:ST3VO
ID: 24312597
But there's no myfile.html because I type the html code on the synedit component/page and when I change the tab to where the web browser component is I need it to preview my code.

know what I mean?
0
 
LVL 8

Expert Comment

by:BdLm
ID: 24312615
can you access the HTML as a string or stream from synedit ?
here is a complete tutorial on webbrowser
 
http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_methods.htm 
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:ST3VO
ID: 24312647
Yes you can but it just won't render properly
0
 

Author Comment

by:ST3VO
ID: 24312669
Used this code:

Procedure TfrmMain.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=Tabsheet2 then
   Begin
 
     LoadFromStrings(SynEdit1.Lines);
   
   end;
end;

It works but doesn't get any css or render properly.

0
 

Author Comment

by:ST3VO
ID: 24312806
OK here's an update:

Please see code below:

It works (well more or less)

There's a problem with is that when I open an external html file into synedit and THEN try to view it on the design view it does not look right at all.

What could be the difference?


procedure TfrmMain.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=Tabsheet2 then
   Begin
 
   EmbeddedWB1.LoadFromStrings(SynEdit1.Lines);
   
   end;
end;

Open in new window

0
 

Accepted Solution

by:
ST3VO earned 0 total points
ID: 24314651
Fixed it! Had to use absolute path and navigate instead of loadfromstrings
0
 

Author Comment

by:ST3VO
ID: 24314680
Fixed it myself.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 202
Communication Between RC4 Delphi <-> PHP 3 115
Show Listview image from database (String field) 5 127
update joined tables 2 47
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question