09-28-2021 08:47 AM
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.
Solved! Go to Solution.
09-28-2021 09:28 AM
09-28-2021 09:34 AM
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
09-29-2021 04:21 AM
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.