thiag0
thiag0

Reputation: 2229

Embedding a PDF file in Excel .xls using C#

Anyone have any tips for how to embed PDF files in a .xls Excel spreadsheet using C#?

Upvotes: 2

Views: 3150

Answers (1)

thiag0
thiag0

Reputation: 2229

For those that need the answer, here it is....

Application xlApp = new Application();
xlApp.DisplayAlerts = false;

Workbook book = xlApp.Workbooks.Open(@"C:\test5.xls", 2, false);

Worksheet sheet = book.Worksheets[1];

sheet.Shapes.AddOLEObject(Filename: @"C:\test.pdf", Height: 400, Width: 400);

book.Save();
....
....
....

Upvotes: 6

Related Questions