Skip to main content

Posts

Showing posts from September, 2019

CSharp: Add Graphical Content inside Excel spreadsheet

In this blog post, I will show you how to add an image (certificate) inside an Excel sheet using OpenXML package in C# DotNet Framework. This is a useful technique when you need to insert some graphical elements into your spreadsheet, such as logos, charts, or certificates. The basic steps are: Create a spreadsheet document or open an existing one. Add a worksheet part to the document or get an existing one by name. Add a drawings part to the worksheet part and create a worksheet drawing object. Add an image part to the drawings part and load the image (certificate) from a file or a stream. Add a non-visual drawing properties object to the worksheet drawing object and set its attributes, such as id, name, and description. Add a picture object to the worksheet drawing object and set its attributes, such as id, name, and description. Add a shape properties object to the picture object and set its transform properties, such as offset and extent. Add a picture fill object to the shape prop