Y
yysun
Unregistered / Unconfirmed
GUEST, unregistred user!
左兄,要点是必须创建一个 Safearray,过程是:
1.初始化:
procedure TForm1.FormActivate(Sender: TObject);
begin
WebBrowser_V11.Navigate('about:blank', EmptyParam, EmptyParam, EmptyParam, EmptyParam);
end;
2.调用 XSLT 以及写入 TWebBrowser
procedure TForm1.ToolButton1Click(Sender: TObject);
var xmlobj, xslobj, xslt, proc: Variant;
HTMLDocument: IHTMLDocument2;
vv: Variant;
ss: string;
begin
xmlobj := CreateOLEObject('MSXML2.FreeThreadedDOMDocument');
xslobj := CreateOLEObject('MSXML2.FreeThreadedDOMDocument');
xslt := CreateOLEObject('MSXML2.XSLTemplate');
xmlobj.async := false;
xmlobj.load('http://www.delphibbs.com/xml/new2/listq_.asp');
xslobj.async := false;
xmlobj.load('http://www.delphibbs.com/xml/new2/listq_1.xsl');
xslt.stylesheet := xslobj;
proc := xslt.createProcessor;
proc.input := xmlobj;
proc.transform;
ss := proc.output;
vv := VarArrayCreate([0, 0], varVariant);
vv[0] := ss;
HTMLDocument := WebBrowser_V11.Document as IHTMLDocument2;
HTMLDocument.Write(PSafeArray(TVarData(vv).VArray));
HTMLDocument.Close;
proc := unAssigned;
xslt := unAssigned;
xmlobj := unAssigned;
xslobj := unAssigned;
end;
1.初始化:
procedure TForm1.FormActivate(Sender: TObject);
begin
WebBrowser_V11.Navigate('about:blank', EmptyParam, EmptyParam, EmptyParam, EmptyParam);
end;
2.调用 XSLT 以及写入 TWebBrowser
procedure TForm1.ToolButton1Click(Sender: TObject);
var xmlobj, xslobj, xslt, proc: Variant;
HTMLDocument: IHTMLDocument2;
vv: Variant;
ss: string;
begin
xmlobj := CreateOLEObject('MSXML2.FreeThreadedDOMDocument');
xslobj := CreateOLEObject('MSXML2.FreeThreadedDOMDocument');
xslt := CreateOLEObject('MSXML2.XSLTemplate');
xmlobj.async := false;
xmlobj.load('http://www.delphibbs.com/xml/new2/listq_.asp');
xslobj.async := false;
xmlobj.load('http://www.delphibbs.com/xml/new2/listq_1.xsl');
xslt.stylesheet := xslobj;
proc := xslt.createProcessor;
proc.input := xmlobj;
proc.transform;
ss := proc.output;
vv := VarArrayCreate([0, 0], varVariant);
vv[0] := ss;
HTMLDocument := WebBrowser_V11.Document as IHTMLDocument2;
HTMLDocument.Write(PSafeArray(TVarData(vv).VArray));
HTMLDocument.Close;
proc := unAssigned;
xslt := unAssigned;
xmlobj := unAssigned;
xslobj := unAssigned;
end;