LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding picture to excel is not saved with report

Solved!
Go to solution

I try to build a report in excel using Labview, in which I have to insert a picture of a certain size into a certain range of cells. Everything is good and correct adding picture to excel in my development computer and correct saving the report. When I made a Labview executable working with Excel 2007 I noticed the picture is added to template then I save report and close. When I open the generated report the picture cells were empty and a reference to the picture exists instead.

It seems to me that the report could not save the inserted picture.

I want to mention that the picture is added to a excel template which does not have any picture control but is added using the excel toolkit. 

Is any way to set any property in excel 2007 to save picture with report that I do not know? 

 

Virginia

0 Kudos
Message 1 of 12
(6,444 Views)

Hello Virginia!

 

I was wondering if you could clarify a couple of things for me.

 

- Are you running the EXE on a different computer (i.e. not the development computer)?

- What is the image you are inserting? Is it an external image, or is it  being generated by LabVIEW?

 

Would it be possible to include a screen shot of the code you are using to insert the image?

 

Thanks again!

 

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 2 of 12
(6,424 Views)

Hi Harris,

In the development computer I am building an exe for customer computer in which a Labview run time is installed. Everything runs under Labview 7.1.1. In development computer I have labview 7.1.1 and Office 2007 which is evaluation version (I used to have 2003, but when I have seen the problem with 2007, I installed this evaluation version of 2007). On customer computer I have professions Office 2007.

The image I inserted in Excel is an existing jpg or tiff image specified by path that exists on hard drive.

Here you have attached the vi inserting picture to excel which is similar with the one from excel toolkit but sizes picture to a certain area.

I repeat what bothers me: in the development computer the report in excel saves images to excel where in customer computer I have something like in this picture (a reference path to the picture as it is seen in row 28). Is any setup that I am missing for the Excel in customer computer?

 

Virginia

Download All
0 Kudos
Message 3 of 12
(6,401 Views)

Virginia,

 

I was just glancing at your question and was curios about something.

The path to the image is in a tempoary file directory.

C:\Documents and Settings\amy\Local Settings\Temp\Image1.bmp

Was this planned as part of the application & installation?

Were the graphic files referenced copied or installed to this folder?

 

LabVIEW 5.0 seems so long ago...
0 Kudos
Message 4 of 12
(6,391 Views)

Hi Virginia,

 

It does look like there is a file path problem with the image. Judging by the screen shot, the problem seems to be that Excel simply can't find the file. (I don't think there is anything wrong with Excel on the target computer)

 

It looks like you've specified an explicit file path for the image file. In that case, when you deploy to the target computer, the application is looking for the static file path "C:\Documents and Settings\amy\Local Settings\Temp\Image1.bmp."

 

If you know where on the deployment/target computer the application will reside, I would suggest putting the image there and programming that file path into your application.

 

For a slightly more versatile approach, you can program your VI to get its own file path, eliminate the VI from the path, and substitute the picture into the file path.

i.e.:

The VI gets its file path: "C:\folder\folder\theVI.vi"

The VI strips the path to get  "C:\folder\folder\"

The VI adds the image name to the file path to get "C:\folder\folder\image.jpg"

 

strip-build-path.png

 

If you use this configuration, it will work in any location as long as the image file is in the same folder as the VI or EXE.

 

Message Edited by charris on 04-26-2010 10:56 AM
Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 5 of 12
(6,375 Views)

Hi Harris,

The code for building the temp path in my application is just the way you showed me in the image, but despite of this setup I am not getting the image inserted but only a reference. As I write in my previous message I have the option to turn the excel visible while I am inserting the picture and I see in target computer the picture is inserted, I save the xls. When I distribute this report I expect the picture to be embedded in excel not a reference that will force me to distribute the picture with (which is not the righrt way).

Is any other method to embed picture in excel?

Thank you,

Virginia

 

0 Kudos
Message 6 of 12
(6,356 Views)
In your AddPicture invoke node, you have a setting LinktoFile set to msoTrue.    What happens if you set that to False?
0 Kudos
Message 7 of 12
(6,349 Views)

Actually, I tried at one moment but I going to try again.

Virginia

0 Kudos
Message 8 of 12
(6,334 Views)
I seem to recall having a similar issue a few years back.  Looking at my old code, I used the AddOLEObject method to get the image into the worksheet.
Randall Pursley
0 Kudos
Message 9 of 12
(6,317 Views)

Hi Everyone,

I  tried again to set the LinkTO File to false in AddPicture and I had a funny result: as usually works well in exe in development computer but in target computer the picture is even worst I do not see as being added.

Related to the  AddOLEObject, I encountered error=-2146827284 with no description and no picture added. I set inputs as close as possible for their meaning but no image is added.

Please, Randall may I have some help?

0 Kudos
Message 10 of 12
(6,301 Views)