LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copying Image to Specified Excel Cells

Hallo,

As part of my programme, i have to copy the graph obtained in the result into an already created Excel Template. The tricky part is that the image should fit inside the specified Rows and coloumns. I have 32 Rows and 9 Coloumns in which the image should fit. The copying of the image is working fine, but it is not being placed in this specified region. Can anyone help me regarding the same? The image is copied as bmp. Should i convert it into PNG and copy? will it make a difference?

 

0 Kudos
Message 1 of 11
(1,117 Views)

Hi Indian,

 


@Speedyindian1 wrote:

The tricky part is that the image should fit inside the specified Rows and coloumns. I have 32 Rows and 9 Coloumns in which the image should fit.


Would it make more sense to fit those 32 rows and 9 columns to the size of the image?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(1,111 Views)

Hi Gerd,

Thanks for the Reply. The problem is that, the template is an internal document from the company and i cannot change it. 

0 Kudos
Message 3 of 11
(1,105 Views)

Hi Indian,

 

then you need to resize/scale the image after inserting it into your Excel template.

There probably is an ActiveX method or property to do so…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(1,079 Views)

umm Okay!

0 Kudos
Message 5 of 11
(1,074 Views)

Your Subject is "Copying Image", but your image is of a graph created by Excel.  In 2014, I posted an Excel Demo that showed how to create an Excel Worksheet with various columns, tables, and an Excel Graph (positioned wherever you tell it to go, and positioned and sized as you specify.  The only "catch" is that you need to let the Report Generation Toolkit create the graph (but the demo shows this being done).  You can find it at Revised "Generate Excel Report" Example .

 

See if this works for you.

 

Bob Schor

0 Kudos
Message 6 of 11
(1,063 Views)

Hi Bob, 

I have written a programme in labview which creates a graph from Moment and angle values. This programme is being used for the past 3 years without a problem. Normally the graph is copied into the excel with the the help of Macros. Now the thing is that, inorder to minimize the use of this Macros, i want to add an extra button, with which the graph which is created in labview, will get first saved as .bmp file and then copied to the Specified cellls in Excel Template. This is the part with which i am having a problem. I am also not sure if it is possible to do so without Macros.

0 Kudos
Message 7 of 11
(1,049 Views)

Hi Indian,

 


@Speedyindian1 wrote:

Now the thing is that, inorder to minimize the use of this Macros, i want to add an extra button, with which the graph which is created in labview, will get first saved as .bmp file and then copied to the Specified cellls in Excel Template. This is the part with which i am having a problem. I am also not sure if it is possible to do so without Macros.


Recreate the VBA macro code by calling the corresponding ActiveX properties/methods…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(1,023 Views)

Hello, Speedy.

 

     In all your messages, you have (so far) not shown us any code, including how you create the data that you are trying to plot.  Actually, I just tried to run my own Demo (which I've done numerous times this year because I mention it to others on the Forum, and usually end up trying to make sure it still works) and it blew up on me, saying that Excel wasn't installed.  This is probably a bug caused by some weird update of my PC by The Powers That Be.  I'll have to try it on my personal machine ...

 

     Anyway, I need to see the LabVIEW code you are using to create the data that you want to display as an Excel Graph -- is there a reason you are hiding it from us?  If you are using LabVIEW 2022 or 2023, please "Save for Previous Version" and specify LabVIEW 2019 or 2021.

 

Bob Schor

0 Kudos
Message 9 of 11
(986 Views)

Hey Bob,

Thank you for your Reply. I am using Labview version 2017. The programme is quite big and it is basically "Company Property". I dont know if i can post the full Labview code. I will clear with the Supervisor and let you know. I will attach a small part with which the graph is being copied to the Excel Template. This part is working, as the graph gets copied into the Template, but not at the corrrect cells. I tried changing the row and coloumn values, but no difference. I am also attaching the picture of the Template with the graph.

Download All
0 Kudos
Message 10 of 11
(962 Views)