Hi,
I'm having difficulties to set a header on a worksheet of the type Chart.
Following shows my code. I iterate over the different sheets, and copy the template header for each one of them. This works fine as long as the sheet is not of type Chart (SheetType.Chart):
foreach(Worksheet ws in originalDoc.Worksheets)
{
for (int i = 0; i < 3; i++)
{
ws.PageSetup.SetHeader(i, overlayDoc.Worksheets[0].PageSetup.GetHeader(i));
Picture pic = overlayDoc.Worksheets[0].PageSetup.GetPicture(true, i);
if (pic != null)
{
byte[] binaryData;
binaryData = pic.Data;
ws.PageSetup.SetHeaderPicture(i, binaryData);
ws.PageSetup.SetHeader(i, "&G");
Picture docpic = ws.PageSetup.GetPicture(true, i);
docpic.Width = pic.Width;
docpic.Height = pic.Height;
}
ws.PageSetup.SetFooter(i, overlayDoc.Worksheets[0].PageSetup.GetFooter(i));
pic = overlayDoc.Worksheets[0].PageSetup.GetPicture(false, i);
if (pic != null)
{
byte[] binaryData;
binaryData = pic.Data;
ws.PageSetup.SetFooterPicture(i, binaryData);
ws.PageSetup.SetFooter(i, "&G");
Picture docpic = ws.PageSetup.GetPicture(false, i);
docpic.Width = pic.Width;
docpic.Height = pic.Height;
}
}
}
Should I be using something else, when encountering a sheet of type Chart?
Thanks for your support.