Example Code

Change orientation and print Word document programmatically with ActiveX

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

Coding that exemplifies how to set an orientation and print a Word document.

 

Description

Changing the properties of a Word document can be useful if you want to customize a document but need a function not already available in report generation VIs. In this example, the orientation of a VI is changed from portrait to landscape and is then sent to the printer.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Create and save a test document.
2. Point the file path of the VI to your test document.
3. Check the ending orientation of the printed document.
4. Run the program.

 

Additional Information or References

Capture.PNG

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