LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel: Format cells and content via LabView possible?

Hi guys!

 

Is it possible to merge cells, insert and change images into specific cells and set their orientation (snap to cell grid) via LabView directly?

Or do I have to make a VBA macro and call that from LabView?

 

Thanks!

0 Kudos
Message 1 of 6
(4,351 Views)

Yes you can.

 

You can use ActiveX nodes in LabVIEW that work like the properties and methods in Excel to work on the cells the same way.

 

Search the Example Finder.   Also look through the message of links in the Excel board to find some good examples.

0 Kudos
Message 2 of 6
(4,321 Views)

Here's an older post with some VIs attached, not sure if the ActiveX commands have been updated/changed since then.

 

http://forums.ni.com/t5/LabVIEW/ActiveX-Topic-Controlling-Formatting-Excel-File-Cell-Parameters/td-p...

 

0 Kudos
Message 3 of 6
(4,303 Views)

It is far easier to use one of the third party Excel add-ons like XLR8 http://sine.ni.com/nips/cds/view/p/lang/en/nid/212056

 

Sure it seems expencive but you do not need Excel installed on the target machine like using Direct-X or NI-Report Generation for Excel  VI's.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 6
(4,289 Views)

As the others have stated, you can probably find a way to do what you want with a fair bit of effort. If your report looks similar every time though, you can format a template excel sheet that has all the formatting you are going to need. Then if you create a new report with the report generation toolkit, you can load up this template sheet.

0 Kudos
Message 5 of 6
(4,275 Views)

If you are using LabVIEW 2014 or 2015, or have the Report Generation Toolkit installed on an older version of LabVIEW, there are functions in the RGT that will do some formatting and other things for you.  For example, I wanted to highlight a row in an already-colored (background) WorkSheet (being used as a Read-Mostly list of parameters for a Behavioral Trial), so I chose to color the Cell Entries (text) Red and Bold, returning them to Black and not Bold when I chose another row.  The function that does this is called Excel Set Cell Font.  I've pasted a 2015 Snippet below.  One caveat -- you need to know how many columns there are in the Worksheet (the sub-VI "Row Limits" figures this out for me).

 

Generally, you use LabVIEW to do simple reads or writes.  If you really need fancy formatting, some is definitely possible, but as Gregory notes, you might have an easier time if the formatting remains constant creating a Template into which you can place your data.

Red One Row.png

Bob Schor

 

0 Kudos
Message 6 of 6
(4,263 Views)