LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Generation from excel

I need to generate a 2-page PDF report in LabVIEW using an Excel template.

  • Each page must have a different page size

    • Page 1 → A4

    • Page 2 → Letter

  • The report data comes from LabVIEW and is written into Excel.

  • The final output should be one single PDF file with two pages.

  • I am using 32-bit LabVIEW with 64-bit Excel.

  • ActiveX is not allowed / preferred.

I am looking for the recommended LabVIEW approach, best practices, or toolkits to implement this reliably.

0 Kudos
Message 1 of 6
(121 Views)

On Windows, you must use ActiveX to write to Excel.

 

George Zou
0 Kudos
Message 2 of 6
(82 Views)

We've had endless troubles with Excel in LabVIEW, especially when trying to do anything very complicated.  We also couldn't find a way other than ActiveX/COM to interact with it.

 

In the end we no longer attempt to save directly to Excel in any new code, and whenever we rev up old code we try to see if there's a way to remove it.  Alternate options include:

  • Saving data as a CSV or other file, then using standard Excel functionality (macros or the "Get Data -> From file" selection on the Data ribbon)
  • Creating a 2D string array that is then changed to a single string delimited by tabs, and copying that string to the clipboard programmatically for pasting into Excel (which would have a special sheet for the data to be pasted into that all other sheets would link to)
    • This includes a "re-copy" button in LabVIEW that re-runs the code that populates the clipboard, either from memory or from loading from a file.  This is mostly just in case someone accidentally copies something else into the clipboard (and either doesn't have or doesn't know how to use clipboard history)
  • LabVIEW saves to a local database, and Excel pulls from that database.
    • This is the most robust and reliable method of the options, but also the most work to set up.
0 Kudos
Message 3 of 6
(66 Views)

My 2014 Revised "Generate Excel Report" Example will help you generate an Excel report using the Report Generation Toolkit which may or may not be present in your version of LabVIEW (it is, I believe, present in the Academic version of LabVIEW, possibly Community Edition, or as a separate licensed Toolkit).

 

That, of course, only gets it into Excel.  Generating a two page Report where you change the paper size setting between Page 1 and Page 2 is a trick that I've not considered.  I'm also not sure about the PDF formatting (I'm currently away from my Desktop machine with the code and example).

 

Bob Schor

0 Kudos
Message 4 of 6
(49 Views)
0 Kudos
Message 5 of 6
(18 Views)

The XLR8 toolkit can read and write XLXS files without using ActiveX or needing Excel installed on the target machine. 

 

Exaprom PDF or just using Windows built in "print to PDF" are two ways to make a PDF in LabVIEW

 

 

 

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