LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save excel table as pdf file programmatically

Solved!
Go to solution

I have a simple excel file that contains a table and I want to save it as a pdf file.  I have done this manually as shown in the attached paint file "Save excel as pdf_1.png" and it works perfectly.  the resulting pdf file is also attached "Student_Records.pdf".

When I try to do the same thing programmatically using LabVIEW Activex, there is no error and the pdf file is created, but when I want to open the programmatically produced pdf file, it shows an error as in the attached file "Student_Records_Programmatically.pdf".

Also attached the zip file that contains the full folder with the Labview VI and the excel and pdf files I am talking about.

Can someone out there tell me what I am doing wrong.

Your help will be greatly appreciated.

0 Kudos
Message 1 of 4
(1,978 Views)

How Can I Write to a PDF or PDF Form with LabVIEW?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(1,969 Views)
Solution
Accepted by topic author Blocka04

Blocka04,

 

Good try so far, but the wrong ActiveX class and method.  The one you actually want is the "ExportAsFixedFormat" method from the Excel._Worksheet class.  (Think of it this way - you can't save a multi-sheet workbook into a PDF, but you can render a print-like representation of a single worksheet.)

 

Below is a handy (well, it's been handy for me) utility I created that isn't part of the Report Generation Toolkit, but I think would make a fine addition to it... hence the "stolen" icon background.  Since your example isn't using the RGT, just grab the ActiveX method call and the "Type" ring.  Note that there's a similar, though incompatible, method for Word automation in there, should you ever need that.

 

Hope this helps,

 

Dave

 

Report Export As Fixed Format.png

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 3 of 4
(1,966 Views)

Thanks very much for your help.

I modified your VI a little bit and it is working perfectly.

Attached is the zip file that contains the full solution.

0 Kudos
Message 4 of 4
(1,930 Views)