Il contenuto non è disponibile nella lingua selezionata.

Verrà mostrato il contenuto in un'altra delle lingue disponibili. Il tuo browser potrebbe avere delle funzionalità di traduzione.

Generate PDF Reports Using the LabVIEW Report Generation Toolkit

Updated May 20, 2024

Reported In

Software

  • LabVIEW Report Generation Toolkit
  • LabVIEW

Operating System

  • Windows

Other

  • Microsoft Office

Issue Details

I am using the LabVIEW Report Generation Toolkit with Microsoft Excel and Word. How can I save my reports in PDF format?

Solution

This article describes different methods to save the Microsoft Excel and Word reports as PDF files by using the LabVIEW Report Generation Toolkit. It also proposes another alternative using a third-party add-on in LabVIEW.

1. Using ActiveX References

This method uses ActiveX references and the ExportAsFixedFormat method to export a Word document or Excel worksheet as a PDF file. The example code is configured to open the PDF file immediately after created. If you do not want to open the PDF file, you can change the OpenAfterExport and OpenAfterPublish boolean constants to FalseNote: this method does not work with HTML reports.


 

2. Using PDF Printer Software

This method uses a third-party PDF printer software in combination with the Print Report VI from the LabVIEW Report Generation Toolkit to generate the PDF file. This method prompts the user to select the directory where the PDF file will be saved. Note: the example code requires the CutePDF Writer software, but can be modified to use similar tools.



If you want to bypass the window where it asks for the user to set a path for the output PDF File we can get the references to the document being printed using the Word Get ActiveX References VI and then use an invoke node to set the output PDF file path. In this example, we set the Microsoft to PDF printer as the default one.

bypass window.png

3. Using LabVIEW Add-Ons

Another alternative is to use third-party add-ons in LabVIEW such as Custom PDF Generator for LabVIEW. Note: this product is supported by the third party and not by NI. For technical support, contact Simplicity AI.

Additional Information

The file, LabVIEW PDF Reports.zip, under the Attachments section contains the example code used in this article. To run the code, you need the LabVIEW Report Generation Toolkit, which is now included with LabVIEW Professional edition, and Microsoft Office installed on your computer.