procedure TForm1.LoadXmlBtnClick(Sender: TObject);
var
searchresult : TSearchRec;
i : SmallInt;
text: string;
xml: TXMLDocument;
XL: Variant;
begin
XL := CreateOLEObject('Excel.Application');
XL.WorkBooks.Open(ExtractFilePath(Application.ExeName)+ 'book.xlsx');
XL.visible := true;
i := 0;
xml := TXMLDocument.Create(nil);
if FindFirst(ExtractFilePath(Application.ExeName) +'\111\'+ '*.xml',faAnyFile,searchresult)=0
then
begin
repeat
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,2].Value:= searchresult.Name;
try
xml.Active := True;
xml.LoadFromFile(ExtractFilePath(Application.ExeName) +'\111\'+ searchresult.Name);
text := xml.DocumentElement.ChildNodes['info'].ChildNodes[2].ChildNodes[0].Text;
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,4].Value:=text;
except
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,4].Value:='неизвестно';
end;
xml.Active := False;
xml := nil;
i:=i+1;
until
FindNext(searchresult) <> 0;
FindClose(searchresult);
xml.Free;
end;
end;
text := xml.DocumentElement.ChildNodes['info'].ChildNodes[2].ChildNodes[0].Text;
xml := TXMLDocument.Create(nil);
begin
repeat
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,2].Value:= searchresult.Name;
try
xml := TXMLDocument.Create(nil);
xml.LoadFromFile(ExtractFilePath(Application.ExeName) +'\111\'+ searchresult.Name);
text := xml.DocumentElement.ChildNodes['info'].ChildNodes[2].ChildNodes[0].Text;
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,4].Value:=text;
xml := nil;
except
XL.WorkBooks[1].WorkSheets[1].Cells[i+4,4].Value:='неизвестно';
end;
i:=i+1;
until
FindNext(searchresult) <> 0;
FindClose(searchresult);
xml.Free;
end;
xml.free
xml := TXMLDocument.Create(nil);
xml := TXMLDocument.Create(Application);
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.