我要做如下处理:有多个html文件,我要一个一个读出来并将纯文本保存到单独的文件中,现在出现的问题就是总是出现重复的和漏掉的(总数是正确的,也就是漏掉的被上一个重复了),不知道为什么,把源码贴在下面,望达人解答:
procedure TForm1.Button1Click(Sender: TObject);
begin
FileListBox1.Directory := LabeledEdit1.Text;
NO := 0;
EPInfo.LoadFromFile(LabeledEdit1.Text + '\'+FileListBox1.Items[0]);
WebBrowser1.Navigate(LabeledEdit1.Text + '\'+FileListBox1.Items[0]);
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
tmp: String;
begin
WebBrowser1.Stop;
EPInfo.Text := IHtmlDocument2(WebBrowser1.Document).Body.outerText;
tmp := EPInfo.Text;
//这里省略保存文件步骤
if NO< FileListBox1.Count - 1 then begin
NO := NO + 1;
WebBrowser1.Navigate(LabeledEdit1.Text + '\'+FileListBox1.Items[NO]);
end else begin
ShowMessage('OK');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FileListBox1.Directory := LabeledEdit1.Text;
NO := 0;
EPInfo.LoadFromFile(LabeledEdit1.Text + '\'+FileListBox1.Items[0]);
WebBrowser1.Navigate(LabeledEdit1.Text + '\'+FileListBox1.Items[0]);
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
tmp: String;
begin
WebBrowser1.Stop;
EPInfo.Text := IHtmlDocument2(WebBrowser1.Document).Body.outerText;
tmp := EPInfo.Text;
//这里省略保存文件步骤
if NO< FileListBox1.Count - 1 then begin
NO := NO + 1;
WebBrowser1.Navigate(LabeledEdit1.Text + '\'+FileListBox1.Items[NO]);
end else begin
ShowMessage('OK');
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货