Example Code

Extracting Text from Rich Text File in LabVIEW

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
  • Other

Code and Documents

Attachment

Overview
This example VI demonstrates how to read a .RTF file and convert it to a LabVIEW string visualized on the front panel.


Description
In LabVIEW you are able to use .NET controls to import files with .RTF extension and convert them to the LabVIEW string format thanks to the use of property node. A while loop inside of the block diagram is used to keep the Rich Text Box populated with the text extracted from the Rich Text file. A file with extension .RTF is given in the attached compressed folder and can be called thanks to the File Dialog Express VI, allowing the user to programmatically select a Rich Text file.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the VI "Convert Rich Text to String 2012 NI Verified.vi"
  3. Run the program
  4. Select the file called "RTF File Example.rtf"

 

Additional Information or References

VI Block Diagram

 

 

Convert Rich Text to String LV2012 NI Verified.png
 

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

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