j := WPViewPDF.Command(COMPDF_Attachment_List);
hstrl := TStringList.Create;
try
for i := 0 to j-1 do
hstrl.Add( WPViewPDF.CommandGetStr( COMPDF_Attachment_GetProp, '', i ) );
for i := 0 to hstrl.Count-1 do
if (Pos('.xml',LowerCase(hstrl[i])) > 0) or (Pos('zugferd',LowerCase(hstrl[i])) = 1) then
try
mem := TMemoryStream.Create;
try
l := WPViewPDF.Command( COMPDF_Attachment_GetData, i);
if l>=0 then
begin
mem.SetSize(l);
WPViewPDF.CommandEx( COMPDF_MakeGetMEMORY, Cardinal ( mem.Memory ) );
mem.Seek(0,soFromBeginning);
zugferdInv := TZUGFeRDCrossIndustryDocument.Create;
zugferdInv.LoadFromStream(mem);
end;
finally
mem.Free;
end;
except
on E:
Exception do MessageDlg(E.Message+' '+e.ClassName, mtError, [mbOK], 0);
end;
finally
hstrl.Free;
end;