Forum

Images not inserted...
 
Notifications
Clear all

Images not inserted - BN.Net

9 Posts
5 Users
0 Reactions
81 Views
(@nirvidxl)
Posts: 4
Active Member
Topic starter
 

Hello All,

I have developed a VB.Net app that adds some information to the Excel sheet and inserts existing images into Excel cell.

Everything works fine on my development PC.

But on the Client's PC, the data is added to the Excel file. However, images are not getting inserted.

What could be the possible reason? How can I resolve this problem?

Please let me if you need more info.

I am using Sheet.Shapes.AddPicture method to insert the .jpeg images.

Thanks for any help.

 
Posted : 12/03/2024 1:21 am
(@debaser)
Posts: 836
Member Moderator
 

Where are the images and what is the actual code line that inserts them?

 
Posted : 12/03/2024 4:38 am
(@nirvidxl)
Posts: 4
Active Member
Topic starter
 

I think the issue is why it works on 1 PC but not on the other. What could be possible reasons? If code works on 1 pc, there should be no problem with the code. The folder is generated by the program in the same folder in which the data files is stored.

 
Posted : 12/03/2024 5:06 am
(@debaser)
Posts: 836
Member Moderator
 

It's much harder to try and diagnose potential issues with code that you can't see... 😉 Especially as you haven't said what is actually happening. Are you getting errors, or placeholders, or nothing, or something else?

 
Posted : 12/03/2024 7:00 am
(@kjbox)
Posts: 69
Trusted Member
 

If the images are stored in a folder on the PC on which the code works, then, sure the code can find and insert the images.

If, however, another PC does not have access to the image folder then the code will fail on that PC.

You need to either send the image folder to all PCs on which you want to run the code, or, better method, would be to have the image folder on a shared drive such as OneDrive or SharePoint.

 
Posted : 12/03/2024 1:32 pm
(@nirvidxl)
Posts: 4
Active Member
Topic starter
 

1. As I have explained, on the client PC images are not getting inserted into the sheet cells. I have also mentioned the method I am using.

2. The Folder is created by the program in the same location that data file is and images are created and stored in that folder by the program. So, there no sharing needed.

3. I have been investigating about permissions and similar issues. But this does not seem to be the issue.

Perhaps I am very close to locating the problem.

Once confirmed I will post the problem and soln. here.

 
Posted : 13/03/2024 1:32 pm
(@keebellah)
Posts: 373
Reputable Member
 

If you have actually read what others have answered then you will hopefully undestand why the images are not loaded on the different systems.

It has nothing to do with permissions or whatever, it has all to do with the simple fact that the folder with the images is not there for  the the other people.

 
Posted : 14/03/2024 5:02 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Nirantar,

How is your code accessing the folder where the images are stored?

Are you using environment variables from the PC?  Is the path hardcoded?

What debugging have you done?

Is your code generating an error when it tries to locate/load an image?  Or is it failing silently? 

Is the folder with the images actually created on the target PC when your app is installed?

You should have some error handling in the code to communicate why an image can't be located.

I can't think of much more to say.  I would have thought that debugging this would be fairly straightforward if you consider the things I've just listed.

Regards

Phil

 
Posted : 14/03/2024 7:20 pm
(@nirvidxl)
Posts: 4
Active Member
Topic starter
 

Finally I got the solution.

All declarations related to Excel needed to be late bound.

eg Dim xlApp As Object (Instead of Excel.Application)

I am not sure why this is needed.

But all is well that ends well.

 
Posted : 15/03/2024 6:28 am
Share: