I've attached a sample project, which does the same tasks in EPPlus & using the Excel Interop. It uses the, latest, (v16) Excel Interop but is not reliant upon this.
Copy from C1:D1 from a worksheet to C1:D100 to another worksheet, only creates a single row on the destination worksheet (instead of duplicating the row over the 100 lines). This works as expected using Excel interop.
I created a workaround by calling a function to manage this fix internally for the short term.
To see this workaround uncomment the 1st line in TestEPPlus.cs.
public static void Copy(ExcelRange srcRange, ExcelRange dstRange)
{
if (srcRange.Rows == dstRange.Rows)
srcRange.Copy(dstRange);
else
{
for (int row = dstRange.Start.Row; row <= dstRange.End.Row; ++row)
srcRange.Copy(dstRange.Worksheet.Cells[row, dstRange.Start.Column, row, dstRange.End.Column]);
}
}
Copy from C1:D1 from a worksheet to C1:D100 to another worksheet, only creates a single row on the destination worksheet (instead of duplicating the row over the 100 lines). This works as expected using Excel interop.
I created a workaround by calling a function to manage this fix internally for the short term.
To see this workaround uncomment the 1st line in TestEPPlus.cs.
public static void Copy(ExcelRange srcRange, ExcelRange dstRange)
{
if (srcRange.Rows == dstRange.Rows)
srcRange.Copy(dstRange);
else
{
for (int row = dstRange.Start.Row; row <= dstRange.End.Row; ++row)
srcRange.Copy(dstRange.Worksheet.Cells[row, dstRange.Start.Column, row, dstRange.End.Column]);
}
}