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

Is it possible embed OLEDB Object to Excel with EPPlus?

Feb 2, 2011 at 2:14 AM

Is it possible embed OLEDB Object to Excel with EPPlus?

I have to implement to insert Image, Word Document and PDF to Excel.

Excel itself and Interop can do that.

I know EPPlus can insert Image, Chart and Shapes to Excel. But I don't find insertion of OLEDB Object in EPPlus.

Any help would be appreciated.

Feb 3, 2011 at 3:12 PM


Sorry, there is no support for OLE objects in the current version.


Feb 7, 2011 at 1:53 AM
Hi Jan,

Noted with thanks.

From: [email removed]
To: [email removed]
Date: Thu, 3 Feb 2011 07:12:29 -0800
Subject: Re: Is it possible embed OLEDB Object to Excel with EPPlus? [EPPlus:244229]

From: jankallman
Sorry, there is no support for OLE objects in the current version.
Read the full discussion online.
To add a post to this discussion, reply to this email (
To start a new discussion for this project, email
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at
Feb 9, 2011 at 2:41 AM

Hi Jan,

Attempt 1)

I made a template excel file as I cannot insert Header/Footer image by package.

Inside template, I create a sample sheet which has Header/Footer with images.

When I write to Excel file with package, I tried to copy that sample sheet to every new sheet.

I can add the new sheet and can write to cells, no error. But after I save the Excel file and open the file with MS Excel, it says file is corrupted.

It seems copy from existing sheet to new sheet is not working.

Even I just copy the workseet to new sheet and didn't write anything is corrupted.
ExcelPackage excel = new ExcelPackage(excelTemplate);
ExcelWorksheet sampleSheet = excel.Workbook.Worksheets["Sample"];
ExcelWorksheet ws = excel.Workbook.Worksheets.Add("Sheet1", sampleSheet);

Attempt 2)

Then I tried to write to that sample sheet. It is OK and I can read back with Excel with existing Header and Footer images.

Then I tried to insert an Image to that sample sheet. It is corrupted again.

FileInfo f = new FileInfo("D:\\Picture.png");

workSheet.Drawings.AddPicture("Picture", f);


Any help would be appreciated.

Thanks for the good job.

Feb 11, 2011 at 10:44 AM


Header footer images are not supported in the current version.

Images in the header and footer uses a VML drawing file, so if you copy the worksheet, the relation to the vml file will not be created for the new sheet and the package will be corrupt.

Attempt 2, im not sure what could be wrong here, create an issue and upload your template and picture with a sample, so i can have a look at it.


May 25, 2011 at 9:30 AM



I am trying to do the same thing (Copy a sheet who has a image in the header), I've seen that the "sheet1.xml.rels" in folder xl\worksheets\_rels\ is not created for the sheet who are copied.

Is there a solution to create it manualy? Do you plan to fix that bug? When did you plan to do the next relaease?


Thx for your great job



May 27, 2011 at 9:00 AM

OK i found this solution, who is not he best one but do the job (Please notice taht it doesn't work, if amn image is in the sheet)

        private void CopySheetRelations(ExcelWorksheet Copy, ExcelWorksheet workSheet)
            var uriTemplateHeaderFooter = new Uri(string.Format("/xl/worksheets/_rels/{0}.rels", Copy.WorksheetUri.OriginalString.Split(new char[] { '/' })[3]), UriKind.Relative);
            var uriNewHeaderFooter = new Uri(string.Format("/xl/worksheets/_rels/{0}.rels", workSheet.WorksheetUri.OriginalString.Split(new char[] { '/' })[3]), UriKind.Relative);
            if (_xlPackage.Package.PartExists(uriTemplateHeaderFooter))
                PackagePart packagePartTemplateHeaderFooter = _xlPackage.Package.GetPart(uriTemplateHeaderFooter);
                PackagePart packagePartNewHeaderFooter;
                if (!_xlPackage.Package.PartExists(uriNewHeaderFooter))
                    packagePartNewHeaderFooter = _xlPackage.Package.CreatePart(uriNewHeaderFooter, packagePartTemplateHeaderFooter.ContentType, packagePartTemplateHeaderFooter.CompressionOption);
                    packagePartNewHeaderFooter = _xlPackage.Package.GetPart(uriNewHeaderFooter);

                using (StreamReader streamReader = new StreamReader(packagePartTemplateHeaderFooter.GetStream()))
                    using (StreamWriter streamWriter = new StreamWriter(packagePartNewHeaderFooter.GetStream(FileMode.OpenOrCreate)))
And I call this function in public ExcelWorksheet Add(string Name, ExcelWorksheet Copy), jsute before //Copy comments