Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:28:02+00:00 2026-06-09T08:28:02+00:00

I am trying to add the same image multiple times into an excel file

  • 0

I am trying to add the same image multiple times into an excel file using EPPlus. I am using the following code to do so:

Image logo = Image.FromFile(path);
ExcelPackage package = new ExcelPackage(info);
var ws = package.Workbook.Worksheets.Add("Test Page");
for(int a = 0; a < 5; a++)
{
    ws.Row(a*5).Height = 39.00D;
    var picture = ws.Drawings.AddPicture(a.ToString(), logo);
    picture.SetPosition(a*5, 0, 2, 0);
}

Everything works perfectly and all the images are correctly added but they are stretched downwards. Here is what one of the pictures should look like:

enter image description here

But it looks like this in excel:

enter image description here

I have to resize each row of the start of each picture but I dont think that would be affecting it. Would there be a way to add the pictures/do what I am trying to do or would I have to copy-paste the images in manually? (I am using the picture as an example)

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:28:03+00:00Added an answer on June 9, 2026 at 8:28 am

    I’m not sure if this is the best solution but definetly a workaround for your problem.

    Here’s what I did:

    ExcelPackage package = new ExcelPackage();
    var ws = package.Workbook.Worksheets.Add("Test Page");
    
    for (int a = 0; a < 5; a++)
    {
        ws.Row(a * 5).Height = 39.00D;
    }
    
    for (int a = 0; a < 5; a++)
    {
        var picture = ws.Drawings.AddPicture(a.ToString(), logo);
        picture.SetPosition(a * 5, 0, 2, 0);
    }
    

    Here is how it looks.

    enter image description here

    For some reason when we have the row height set, its interfering with the picture height.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to add value into foreign key field, if same data doesn't exist
When I am trying to add a given image to the same destination city
i'm trying to add some animated gif into static image (canvas), here's my start
I'm trying to write some code to look through an image file for groups
In the code below, I am using an image images/newlogo.PNG for a logo. I
I'm trying to create a CSS3 button which includes an image using multiple background.
I'm trying to add table rows programmatically following the code here /* Find Tablelayout
I'm trying to add class visible to a div with the same ID as
I'm trying to add two object that they are in the same class. In
I am trying add picture boxes dynamically. My code is as PictureBox picture =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.