Free Support Forum - aspose.com

Cells.CopyRow doesn�t copy the row formatting!

Cells.CopyRow doesn’t copy the row formatting !!!

Documentation for Cells.CopyRow states that method will copy the entire row and formatting.

I have a template with the header (first row) defined and configured in Excel. Some columns have a Date Format and also have hidden columns.

When I have used code below I have created new Worksheet and copied row did not have original:

  1. Column size
  2. Column format
  3. Text alignment
  4. All hidden columns become unhidden .

Cells firstRowToCopy = this.lastUsedWorkSheet.Cells; // We will copy this row to the new worksheet.

AddNewWorkSheet();

// Copy headers.

this.lastUsedWorkSheet.Cells.CopyRow(firstRowToCopy, sourceRowIndex, destinationRowIndex);

Please investigate.

Thanks,

Daniel

Hi Daniel,

CopyRow method only copy row formattings, not column. That's same as MS Excel.

Any settings that are not in the specified row will not be copied.

And which version of Aspose.Excel are you using? Is it v3.6?

Thanks for your reply, this make sense.

My Aspose.Excel.dll is 3.6.0.1.

Can you please advise how can I make new worksheet identical to the existing worksheet preserving all formatting and styles (rows and columns)?

Thanks,

Daniel

Please try Worksheet.Copy method.

Thank you. I will try it.

Thanks,

Daniel