Solved

HTML Preview

Posted on 2009-05-06
8
454 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
Comment Utility
use the TWebbrowser , TWebbrowers.navigate(myfile.html)

0
 

Author Comment

by:ST3VO
Comment Utility
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
Comment Utility
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
 

Author Comment

by:ST3VO
Comment Utility
Yes you can but it just won't render properly
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:ST3VO
Comment Utility
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
Comment Utility
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
Comment Utility
Fixed it! Had to use absolute path and navigate instead of loadfromstrings
0
 

Author Comment

by:ST3VO
Comment Utility
Fixed it myself.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now