Hello,
I would need to copy from one excel file one row (to many rows) at once to another excel-file. What would be the best to do?
Sincerely
Peter
Hello,
program Project11;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, VCL.FlexCel.Core, FlexCel.XlsAdapter;
const
rowToCopy = 2;
destRow = 5;
destCount = 3;
var
XlsIn, XlsOut: TXlsFile;
begin
XlsIn := TXlsFile.Create('r:\test.xlsx');
try
XlsOut := TXlsFile.Create(1, TExcelFileFormat.v2013, true);
XlsOut.InsertAndCopyRange(TXlsCellRange.Create(rowToCopy, 1, rowToCopy, 1),
destRow, 1, destCount,
TFlxInsertMode.ShiftRowDown, TRangeCopyMode.All, XlsIn, XlsIn.ActiveSheet);
XlsOut.Save('r:\restult.xlsx');
finally
XlsIn.Free;
end;
end.