From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

export xy graph to power point?

Solved!
Go to solution

@murchak wrote:

"The references (are these the three references XYGraph, XYGraph2, XYGraph3 AND the PowerPoint._Application connected to the Automation Open function?) are implicitly linked to the control (is this control the input of the Open Automation function?) with the same label (The XYGraph, XYGraph2, XYGraph3 are different labels that PowerPoint._Application. How are they implicitly linked?).  Unless of course you do something silly like edit the label of a reference.   

Each iteration of the for loop copies one plot image to the clipboard and pastes it into PPoint.

 

Edit:

 

I see, the automation refnum.  That control is generated by right-clicking the automation open function and selecting the ActiveX class, in this case PP._Application.  It provides the type for the reference.  You can right-click that and make it a constant if you want.


The PowerPoint._Application is a type specifier for the Automation Open function.  It tells Automation Open that I want a reference to a PowerPoint application.  It returns the reference so I can use the properties and methods to control PowerPoint.

 

The XYgraph references are implicitly linked to their corresponding controls.  They are linked automatically by going to the control or terminal, right-clicking and choosing to create a reference.  You can right-click a reference and use the Link to menu to see or change the linked control.

 

The big picture is that I iterate three times, once for each graph.  I tell PPoint to create a new slide and I tell LV to copy one of the graphs to the Clipboard.  Next I tell PowerPoint to paste the image on the new slide and move it.  I use dataflow to coordinate the copy-paste timing and I use the Clipboard to pass data between LV and PowerPoint.

0 Kudos
Message 11 of 31
(1,548 Views)

Darin, thanks for your replies. I must be running your patience.

 

I understand the reference to the graphs. I can right-click on XYGraph, XYGraph2, and XYGraph3 and create a reference for each one of them.

I also know that reference is simply a pointer that points to a particular object. So for example when XYGraph3 reference is connected to "XYGraph strict" method, the method performs an action on XYGraph3. I got that.

I aslo know what the for loop is doing.

 

HOWEVER, what I don't understand or see is the "Link" between the three graphs and the automation that tells LabVIEW to export those particular three graphs to PowerPoint.

See the attached picture and the questions I've written. Hopefully, this picture will illustrate what I am failing to see.

 

 

Untitled.jpg

0 Kudos
Message 12 of 31
(1,539 Views)

The connection is via the clipboard.  I call the method on a graph to place an EMF image onto the clipboard.  Notice the export target.  The error wire is for timing, I do not want the subsequent paste operation in PowerPoint to occur until after I put the proper image onto the clipboard.

 

This is automating the process you would go through.  Select Graph, copy, open PowerPoint, Create Slide, Paste Image, reposition.

 

Hopefully that makes sense.

0 Kudos
Message 13 of 31
(1,536 Views)

It's starting to make sense. So which part of the code in Part A (see the diagram in my previous post) acts on the image on the clipboard. How does this part know that there is an image on the clipboard waiting to be exported.

0 Kudos
Message 14 of 31
(1,529 Views)

The Paste method of the Shapes class does the dirty work.  It finds an image on the clipboard because you just put it there.  There is a tiny chance that some other program puts something else there in the blink of an eye between the copy and paste operation.  If you worried about that you would save the image of the graph to a file and then place the file into PPoint.  I prefer the in-memory process with the clipboard.

Message 15 of 31
(1,526 Views)

Thank you so much!! Great help!

0 Kudos
Message 16 of 31
(1,526 Views)

Hi Darin,

 

Is it possible to use the same method to export a decoration box (with objects inside of it) to PowerPoint? With the XYGraph, I could right-click on it and choose the Invoke Method = Export Image.

But with a decoration box, I don't see a similar "export" option. You did help me create a PNG image of the objects with a decoration box around them. Is it easier to export those images to

PowerPoint once they are created as PNG images sitting in a folder, or can it be done directly from the LabVIEW environment before the Image Data is saved as a PNG file? In order words, can

labVIEW point to "Image Data" and export that to PowerPoint?

0 Kudos
Message 17 of 31
(1,490 Views)

A decoration box does not have those methods available. It seems like getting the PNG would be the better option.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 18 of 31
(1,476 Views)

Any suggestions on how to do that ? 🙂

0 Kudos
Message 19 of 31
(1,471 Views)

Instead of the Paste method of the Shapes Class, invoke the AddPicture method and give it the filename to the PNG file.  I would use a temporary file and not link to it (embed into PP instead).  I think this is the default behavior.

0 Kudos
Message 20 of 31
(1,463 Views)