'How do I clone existed complicated rows to the work sheet using openxml

I need to clone exists rows to the work sheet dynamically. ex. I wanna copy row 28, 29 and insert into 30, 31, or 32,33, or more maybe, it depends on the data rows. from enter image description here

to enter image description here

How to do that in openxml dynamically? Thanks in advance.



Solution 1:[1]

Finally, I use EPplus instead of OpenXML, Just 2 lines to solve my problem.

private void AddRows(ExcelWorksheet sheet, int rowFrom, int colFrom, int rowTo, int colTo)
    {           
        sheet.InsertRow(rowFrom,2);
        sheet.Cells[28, 1, 29, 46].Copy(sheet.Cells[rowFrom, colFrom, rowTo, colTo]);
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brad Huang