Hi Mahgah,
I tried with these guidelines only.
If you see the code is in line with the suggestion.
ZipFileName := 'Attachments_' + Format(CurrentDateTime) + '.zip';
DataCompression.CreateZipArchive();
docAttached.Reset();
docAttached.SetRange(JobNo, Rec."Job No.");
docAttached.SetRange(JobTaskNo, Rec."Job Task No.");
docAttached.SetRange("Table ID", 122);
docAttached.SetRange("No.", docno);
if docAttached.FindSet() then begin
Page.Run(1173, docAttached);
repeat
TempBlob.CreateOutStream(DocumentStream);
RecRef.GetTable(docAttached);
FldRef := RecRef.Field(docAttached.FieldNo("No."));
FldRef.SetRange(docAttached."No.",);
if RecRef.FindSet() then begin
repeat
TempBlob.CreateInStream(IStream);
docAttached."Document Reference ID".ExportStream(DocumentStream);
FullFileName := Format(docAttached."File Name" + '.' + docAttached."File Extension");
DataCompression.AddEntry(IStream, FullFileName);
until RecRef.Next() = 0;
end;
until docAttached.Next() = 0;
Tempblob.CreateOutStream(DocumentStream);
DataCompression.SaveZipArchive(DocumentStream);
TempBlob.CreateInStream(IStream);
DownloadFromStream(IStream, '', '', '', ZipFileName);
end;
This is the code.
Thanks,
Indira