你可以把s存到一个htm文件里阿(比如通过memo)
然后用webbrower.navigate('filepath+filename')
就可以了阿

解决方案 »

  1.   

    下面是BCB代码,可能经过修改就可以在Delphi中使用了.//SetHtmlSourceToControl 直接设置Html内容到控件中
    void __fastcall SetHtmlSourceToControl(const AnsiString &HtmlSource)
    {
      HRESULT hr;
      IPersistStreamInit *psi;
      IStream *pContentStream;
      HGLOBAL hMemHandle;
      int SourceLength;  //
      SourceLength = HtmlSource.Length();  hr = WebBrowser->Document->QueryInterface(IID_IPersistStreamInit,(void**)&psi);
      if(SUCCEEDED(hr))
      {
        hMemHandle = GlobalAlloc(GPTR,SourceLength);
        CopyMemory((PVOID)hMemHandle,HtmlSource.c_str(),SourceLength);    hr = CreateStreamOnHGlobal(hMemHandle,true,&pContentStream);    if(SUCCEEDED(hr))
        {
          hr = psi->Load(pContentStream);
          if(FAILED(hr))
            SetStatus("出现错误:" + SysErrorMessage(hr));
        }
        else
          SetStatus("出现错误:" + SysErrorMessage(hr));    GlobalFree(hMemHandle);
        psi->Release();
      }
      else
        SetStatus("出现错误:" + SysErrorMessage(hr));
      

  2.   

    sorry,刚才看错了,不过要想webbrower能读出<html>标签,那么这个html文件就应该要可以显示出标签来,这里有一个例子.用的时候把你要的东西替换到innertext部分里面就可以了
    <html>
    <head>
    </head>
    <body>
    <pre id="myid">
    <SCRIPT language="javascript">
    <!--
       
       myid.innerText="<html><h1>test</h1></html>"  
       
     // -->
    </script>
    </pre>
    </body>
    </html>