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.

Example Code

Insert Image in Microsoft Word Table Using LabVIEW

Code and Documents

Attachment

Overview

This an example to insert an image into the table cells of a new Microsoft Word document using the LabVIEW Report Generation Toolkit.

 

Description

Using the LabVIEW Report Generation Toolkit, we can add a table into a new Microsoft Word document by using the New Report VI and the Append Table to Report VI.  However, this appears to only allow a user to enter text into the created table cells.  If a user wants to insert an image into one of these cells instead, there is a way to do this using the Word Edit Cell VI and using a File Path Control to specify the path of a saved image.

 

Requirements

  • LabVIEW 2012(or compatible)
  • LabVIEW Report Generation Toolkit 2012(or compatible)

 

Steps to Implement or Execute Code

  1. Save the image you want to insert into a Word table cell as a .jpeg, .bmp, .png, .gif, or .tif file.
  2. Select this file path using the File Path Control on the VI front panel.
  3. Run the VI.

To adjust which cell into the table is being inserted, edit the Start (0,0) terminal of the Word Edit Cell VI to change the desired row and column for the image.

 

Additional Information or References

VI Snippet

 

1.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Regards,
Austin S.

National Instruments
Academic Field Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.