Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Preserving Excel 2007 Features when using Templates, Code examples to insert Images
posted

Dear Infragistics Support,

  1. I have an Excel XLSX template I'd like to use so that I can have the header and footer already set up the way I want them to.  There are images in both the header and footer. If I simply open the Template and then immediately save it with no changes I get an error.  Obviously this has to be addressed before I can consider making changes to the workbook before saving.  The Excel template is an embedded resource, so I get the stream for it using Application.GetResourceStream, and then open the stream using Excel.Workbook.Load.  I get the error when I try to save the workbook using Workbook.Save(to_another_stream). I seem to recall that for the 2011.1 release there were issues with Excel preserving certain advanced worksheet features involving images.  I am currently using the 2011.2 release. Is this what's happening here?  Perhaps this has already been fixed in a more recent release?
  2. I'd like the option of not using a template but I couldn't find any detailed code examples of how to put images in parts of the Excel headers and footers.  Can you provide some?
  3. I'd also like to have detailed code examples for putting images in a cell.  In this case, I'd also like to know if it is possible to make it so the image does not re-size but simply moves when the row or column containing the cell with an image in it is re-sized, preserving the original aspect ratio of the image.  Each image would be anchored completely within one cell so that it appears to be a cell value.

Below is the error I am getting (referred to in 1. above) when trying to save the unmodified template XLSX file back to disk:

'summaryBelow' is a duplicate attribute name (at XmlWellFormedWriter.AddAttribute)

The Excel Template file I'm using is attached.

Thanks!

ExcelTemplate.zip