04-22-2010 09:52 PM
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
Solved! Go to Solution.
04-23-2010 04:03 PM
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!
04-25-2010 09:16 PM
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
04-25-2010 10:18 PM
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?
04-26-2010 10:54 AM - edited 04-26-2010 10:56 AM
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"
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.
04-26-2010 03:06 PM
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
04-26-2010 03:13 PM
04-26-2010 06:24 PM
Actually, I tried at one moment but I going to try again.
Virginia
04-27-2010 07:53 AM
04-27-2010 08:41 AM
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?