31. Mai 2022 10:51
31. Mai 2022 15:52
31. Mai 2022 16:29
31. Mai 2022 17:49
ExcelFile.Create(FileName + '.xlsx');
ExcelFile.CreateOutStream(OutS);
ExcelBuffer.SaveToStream(OutS, false);
1. Juni 2022 08:15
NAVGATOR hat geschrieben:Könnte das ungefähr dann so aussehen?
1. Juni 2022 08:37
procedure SaveToStream(var ResultStream: OutStream; EraseFileAfterCompletion: Boolean)
var
TempBlob: Codeunit "Temp Blob";
BlobStream: InStream;
begin
FileManagement.BLOBImportFromServerFile(TempBlob, FileNameServer);
TempBlob.CreateInStream(BlobStream);
CopyStream(ResultStream, BlobStream);
if EraseFileAfterCompletion then
FILE.Erase(FileNameServer);
end;
procedure BLOBImportFromServerFile(var TempBlob: Codeunit "Temp Blob"; FilePath: Text)
var
OutStream: OutStream;
InStream: InStream;
InputFile: File;
begin
IsAllowedPath(FilePath, false);
if not FILE.Exists(FilePath) then
Error(FileDoesNotExistErr, FilePath);
InputFile.Open(FilePath);
InputFile.CreateInStream(InStream);
TempBlob.CreateOutStream(OutStream);
CopyStream(OutStream, InStream);
InputFile.Close;
end;
Clear(ExcelBuffer);
ExcelBuffer.Reset();
ExcelBuffer.DeleteAll();
ExcelBuffer.CreateBook(FileName + 'temp.xlsx', InvoiceLineLbl);
1. Juni 2022 10:04
codeunit 50032 "Excel Magic"
{
trigger OnRun()
begin
DoSomething();
end;
local procedure DoSomething()
var
ServTempFileName: Text;
begin
ServTempFileName := FileMgt.ServerTempFileName('xlsx');
ExcelBuffer.CreateBook(ServTempFileName, 'MyBook');
ExcelBuffer.NewRow();
ExcelBuffer.AddColumn('hello', false, '', false, false, false, '', ExcelBuffer."Cell Type"::Text);
ExcelBuffer.WriteSheet('HELLOWORLD', CompanyName(), UserId());
ExcelBuffer.CloseBook();
FileMgt.DownloadTempFile(ServTempFileName);
end;
var
ExcelBuffer: Record "Excel Buffer" temporary;
FileMgt: Codeunit "File Management";
}
FileMgt.DownloadTempFile(ServTempFileName);
FileMgt.CopyServerFile(ServTempFileName,'<<<<SavingPathWithFullFileName :)>>>>',false);
1. Juni 2022 10:40
1. Juni 2022 10:49