WebBrowser에 HTML 내용 바꾸기 ( Delphi & C++ Builder )

TWebBrowser의 HTML을 변경하려면 우선..WebBrowser1.Navigator(‘About:Blank’)로 초기화를 한뒤에 아래와 같이 작업하시면 됩니다.

델파이와는 다르게 C++ Builder에서는 variant형의 지원때문에 조금 길어 보입니다.
내용은 100% 동일합니다.

Delphi

 WebBrowser1.OleObject.Document.Body.innerhtml :=  WebBrowser1.OleObject.Document.Body.innerhtml +
'<FONT color=#3058d2><SPAN style="FONT-FAMILY: Gulim"><SPAN style="FONT-SIZE: 10pt"><STRONG> 이름 : </STRONG> </SPAN> </SPAN> <SPAN style="FONT-FAMILY: Arial"> <SPAN style="FONT-SIZE: 10pt"> <FONT color=#000000>' + Edit1.Text + '</FONT> </SPAN> </SPAN> <br /> </FONT>';

 


C++ Builder

WebBrowser1->OleObject.OlePropertyGet( "Document").OlePropertyGet("Body").OlePropertySet("InnerHtml",
String(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VarToStr( WebBrowser1->OleObject.OlePropertyGet( "Document").OlePropertyGet("Body").OlePropertyGet("InnerHtml") )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "<FONT color=#3058d2> <STRONG> 이름 : </STRONG> <FONT color=#000000> "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + Edit1->Text&nbsp; + " </FONT> <br /> </FONT>"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ).c_str()
&nbsp; );

 

 

Author: yyjksw