aditya
aditya

Reputation: 342

NPOI - Add image to excel header

Can someone please help me out with how i can insert an image into the header of an excel document? I am using NPOI to generate my excel,i am able to insert text data in the header, however the documentation does not point out on how i can insert images into the header.

Upvotes: 0

Views: 1143

Answers (2)

Gerhard
Gerhard

Reputation: 1

Well, this post is quite old but I'm just working on a solution using NPOI as well.

I was searching a way to format the sheet header and found this https://learn.microsoft.com/de-de/office/vba/excel/concepts/workbooks-and-worksheets/formatting-and-vba-codes-for-headers-and-footers

You'll use the &G format code to place an image into the header (or footer). For me, this works fine with bold (&B) font, and font size.

I assume that you have to place the path to the image after the format code.

Happy testing.

Just found something probably helpful: https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Excel-Header-and-Footer/Add-Image-Header/Footer-in-C.html

Upvotes: 0

aditya
aditya

Reputation: 342

It looks like NPOI does not have a way to achieve this directly. As a work around a created a excel template with header image and used NPOI to fill the data. Hope it helps someone.

Upvotes: 2

Related Questions