How to copy cell to another workbook keeping original style?

Mar 5, 2011 at 1:01 AM

Keep original background color, font, cell merge(cell contains multi-columns), that says need a complete clone.

I tried this:

targetCell.Style = Source.Style;

Error: Can not set cell style cross workbook.

How to get this done?


Mar 17, 2011 at 8:01 AM

I suggest you use the original workbook as the template

Jul 6, 2014 at 8:03 PM
Hello Tonyqus,

I have some questions:

How can I get original workbook as template using NPOI?

When I clone or set the style of original workbook to new one. I got "excel corruption errors".

//ICellStyle newStyle = maskedWb.CreateCellStyle();
//maskedCell.CellStyle = newStyle;

What should I do?