LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save report VI from report generation toolkit is broken

Solved!
Go to solution

Nice suggestion and workaround. I used "SaveCopyAs"  as a method to generate and save an Excel report in Office 365.

My issue was a little more subtle: The Save Report VI did not appear broken, but just would not save with the "SaveAs", but "SaveCopyAs" worked just fine:

I saw this problem in the fllowing Office Release:

VVF_0-1580361383426.png

 

Interestingly, later versions of Office - xxxx-20738 (last 5 digits) worked just fine with either of the methods.

What is more peculiar is that I had an issue of SaveAs" generating error on Office 2013 with error -2147417851: The server threw an exception.

It seems that RGT is very sensitive to a particular Office installation and there is no direct correlation of RGT performance to Office release.

Thank you again for the suggestion

0 Kudos
Message 41 of 51
(1,205 Views)

Thank you so much, you save my life.

0 Kudos
Message 42 of 51
(1,096 Views)

Sadly,

 

I have tried all of these workarounds with my NI 2017 code that uses ExportAsFixedFormat for the ExcelWorksheet class. 

I still get the Error -2147467259 occurred at Exception occured in Microsoft Excel: Document not saved.  result.

My code is stuff written back in 2019 by someone else and the workflow requires this method, not SaveAs, and SaveCopyAs isn't even an option.  And in my case, the Office 365 is the exact same install on both my dev machine and the target machine (which does not have an NI system on it and it gets the program as a .exe.)

 

Still hunting for a solution,

DLC

0 Kudos
Message 43 of 51
(602 Views)

If you make a fresh VI and recreate everything does the problem still occur? stuff gets corrupted sometimes

Does task manager show multiple instances of excel? if so, kill all those and try again..

 

Finally, if nothing else works then just call python module and pass your target text in. 

https://www.soudegesu.com/en/post/python/create-excel-with-openpyxl/#save-file

 

Sr Test Engineer at American Innovations - LabVIEW CLA - Kudo's are appreciated!!
0 Kudos
Message 44 of 51
(592 Views)

If you make a fresh VI and recreate everything does the problem still occur? stuff gets corrupted sometimes.

I didn't try re-writing the whole vi, just the "Invoke Node" part of the vi, and did a mass compile of the whole project to boot. Since nothing else that anyone has found seems related to my problem, I will break down and do this next.

Does task manager show multiple instances of excel? if so, kill all those and try again..

Tried that too, not an issue.

 

Finally, if nothing else works then just call python module and pass your target text in. 

https://www.soudegesu.com/en/post/python/create-excel-with-openpyxl/#save-file

I have used openpyxl for a couple of Python projects.  To do that would be to re-write the entire program in Python since the LV implementation starts with a template and does extensive modifications from data pulled from Oracle before it gets to the PDF creation whose data comes as a RGT "mega" cluster link.  Needless to say, I thought about that, but was not sure how to get a Python module compiled into the .exe for distribution.

 

I wanted to drop a line here for those who are still looking for a solution or someone who may have actually FOUND what the deal is and link them to my current thread started at the link I provide above.  Apologies for accidentally starting a parallel thread to an existing one.  So, we shouldn't be extending this, possibly zombie thread any more.  Mea Culpa.

 

be well,

DLC

0 Kudos
Message 45 of 51
(584 Views)

Have you fixed that issue???

0 Kudos
Message 46 of 51
(375 Views)

NI_ReportGenerationToolkit.lvlib:ex_RGT_Append Anything To Report.vi -> NI_ReportGenerationToolkit.lvlib:subMS Office Report Block.vi -> Report_Generator.vi:MS Office Report.vi->

 

Can anyone knows , how to fix this isssue??

 

0 Kudos
Message 47 of 51
(372 Views)

Good morning, @Suman555.

 

From the post before your first post on this thread,


@DLMC wrote:

So, we shouldn't be extending this, possibly zombie thread any more.  Mea Culpa.


You seem to be having a problem with saving a VI Report from the Report Generation Toolkit.  Many of us (I, included) have used this feature for years without trouble, though Microsoft does throw in the odd "improvements" to Excel that we need to "fix" periodically to get the RGT to work.

 

Please start a new Thread, explaining your problem, providing code (enough so that we can actually try what you want to do and figure out how to get it to work for you) and example data.  When you do so, be sure to also tell us what version of LabVIEW you are using (and whether you are running 32-bit or 64-bit LabVIEW), what version of Excel/Office you have, and provide (some) data to write in the Report.

 

Are you able to get any of the RGT Example code to work?  A decade ago, I posted a Revised "Excel Report Example" that still seems to work.  You could give it a try.

 

If you are still having problems, do include your own (small) test routine to show us what you are trying to do, along with any data files that your example requires.  Be sure to give us sufficient information to be able to open your attachments.  Be sure to tell us the version of LabVIEW you are using, and consider doing a "Save for Previous Version" and specify LabVIEW 2019 or 2021 (both of which I have, but nothing more recent).

 

Bob Schor

0 Kudos
Message 48 of 51
(354 Views)

Since I still appear to be watching this thread, I'll post here what eventually solved the problem.

First, it isn't an NI problem.  This issue occurs because of a "feature" in Office 365 that some corporations or businesses use in Office 365.  A "sensitivity" setting where you determine who should be able to see the document.  The problem has two aspects.

1- Using a .xlsx template file which may have been created before the "sensitivity" setting existed in Excel.

2- Trying to create a PDF from a .xls template file.

 

Solution for #1: Open the .xlsx template file with your Office 365 Excel and set the sensitivity manually when it asks, then save the file.

Solution for #2: There is none, Office 365 will refuse to create a PDF from a .xls file.  You will find that it won't create the PDF if you open the file manually to do it either.  Open your .xls file with Office 365 Excel and saveas a .xlsx template file.  Then change your vi to reference the "new" file.

 

(About #1, I found that if you open Task Manager (ctrl-Shift-Esc) you will find Excel running, click the "arrow" and you'll see one of the threads is the pop-up to set the sensitivity on the file.  If you double-click on that thread you can answer the question which will release the lock and your vi will finish.  Not very convenient, just do the open-set-save steps to avoid the hassle.)

 

On a related topic...

NI users are typically 32-bit because the 64-bit NI does not have as rich of a library set.  If your Office 365 install is 64-bit, this causes a minor problem.  NI may not have set up the connections for an Invoke Node to call Excel routines.  Contrary to those who say you cannot call 64-bit programs from 32-bin NI, not so.  What you do have to do is dig into the Windows Registry to set that connection up and voila! the calls are available to your vi. I do not have my notes in front of me, sorry. Google for this solution, it is in the NI solutions set, somewhere.  It is actually pretty simple.

 

be well,

DLC

Message 49 of 51
(340 Views)

@DLMC wrote:


If your Office 365 install is 64-bit, this causes a minor problem.  NI may not have set up the connections for an Invoke Node to call Excel routines.  Contrary to those who say you cannot call 64-bit programs from 32-bin NI, not so.  What you do have to do is dig into the Windows Registry to set that connection up and voila! the calls are available to your vi. I do not have my notes in front of me, sorry. Google for this solution, it is in the NI solutions set, somewhere.  It is actually pretty simple.


That is actually a “feature” of the Click to Run installer most companies (and users) use to install Office. Somehow if “forgets” to register the Excel (and other Office application) ActiveX Automation Server in a way that lets 32-bit applications call it. I have been able to fix this in the past by doing a Repair Install of the Office applications.

Rolf Kalbermatter
My Blog
Message 50 of 51
(328 Views)