This project has moved. For the latest updates, please go here.

Lost header and footer when copy worksheet

Jul 24, 2012 at 1:51 PM

Hi,

I'm trying to copy sheets using an excel template and the sheet has header and footer, but after copy they don't appear. Only the data and cells appears. I use the method .CopyTo to copy.

IXLWorksheet sheet_new = sheet_old.CopyTo("Sheet_new");

Can you help me out?

Thank you very much.

Coordinator
Jul 26, 2012 at 4:24 PM

Pick up the latest source code.

Jul 30, 2012 at 2:38 PM

The last version of ClosedXML?

Ok, I did it and still don't copy the header and footer..

Coordinator
Jul 30, 2012 at 3:32 PM

How can I reproduce it? The following works fine:

            var wb = new XLWorkbook();
            var ws = wb.AddWorksheet("Sheet1");
            ws.PageSetup.Header.Left.AddText("Lorem Ipsum");
            ws.CopyTo("Sheet2");
 
            wb.SaveAs(@"Sandbox.xlsx");
Jul 30, 2012 at 3:40 PM

It's simple! Create an template with an image in the header, some text in the footer and try to copy that sheet to other using the method .CopyTo()

Hmm, i never tried like you do:

ws.PageSetup.Header.Left.AddText("Lorem Ipsum");

This results with images in header or footer?

 

Coordinator
Jul 30, 2012 at 3:53 PM

Images are not supported

Jan 11, 2016 at 6:14 PM
any plans to add support for images any time soon? would be super useful to my situation where I need to have a logo in the header. thanks!