Procedure Tform1.SaveTopicToFile();
var HTMLDocument: IHTMLDocument2;
theCt:TstringList;
begin
try
stb.Panels[1].Text:='Saving...';
application.ProcessMessages ;
if not saveHtmDlg.Execute then exit;
if Fileexists(saveHtmDlg.FileName) then
if MessageDlg('文件以存在,是否覆盖?',mtConfirmation, [mbYes, mbNo], 0) = mrNo then
exit;
try
HTMLDocument:=web.Document as IHTMLDocument2;
theCt:=TstringList.Create;
theCt.Add('<html><style>td,body,table,font{font-size:9pt;}{</style>');
theCt.Add('<base herf="'+localPath+'">');
theCt.Add(HtmlDocument.body.outerHTML);
theCt.Add('</body></html>');
Application.ProcessMessages;
theCt.SaveToFile(saveHtmDlg.FileName);
theCt.Free;
HtmlDocument:=nil;
stb.Panels[1].Text:='Save Complete';
except
stb.Panels[1].Text:='Saveing Except!';
end;
except
stb.Panels[1].Text:='Saveing Except0!';
end;
end;