09-13-2019 07:05 AM - edited 09-13-2019 07:06 AM
Hello
I have a problem with RGT using wrong VIs.
Program is set to open a dotx template and save a word document, however this actions fails as document can not be opened. This is the full error:
Possible reason(s): LabVIEW: (Hex 0x7) File not found. The file might be in a different location or deleted. Use the command prompt or the file explorer to verify that the path is correct. Complete call chain: Get LV Class Default Value.vi NI_report.lvclass:New Report.vi ReportSaveAndPrint.vi AnalyzeIt.vi Main.vi LabVIEW attempted to load the class at this path: C:\Program Files (x86)\Main\Carbon2015.exe\1abvi3w\vi.lib\Utility\NIReport.llb\Word\NI_Word.lvclass
From what i gather NI_Word.lvclass is not included in the application during building. I checked this and it's true, instead Labview includes NI_HTML.lvclass.
I found some solutions online advising that you manually add a proper lvclass file to the project, but for some reason it won't let me. I also tried replacing all VIs that use NI_HTML.lvclass for ones that use NI_Word.lvclass, but when application is built it just replaces VIs for the HTML class ones.
This is the VI that does the report:
So my question is, how do i force Labview to use NI_Word.lvclass instead of HTML one? No function from NI_HTML.lvclass is needed, because report only generates a Word (docx) file.
I am using Labview 2018 (x86) to build an application.
Solved! Go to Solution.
09-13-2019 12:14 PM
I'm sorry, but what you show isn't "the VI that does the report". It's a small print, hard-to-read, impossible to test, picture of some LabVIEW code.
I just wrote a very tiny test routine that opened a Word report, wrote two lines of text, saved it to a thumb drive as a docx, and disposed of the Report. Worked fine.
If you don't want to attach your VI so we can really see what you are doing, I recommend that you try writing a simple test routine (as I did), test it, then start adding other bits and pieces until it duplicates the functionality that is now not working for you. Does the failure only happen when you try to build an Executable? Do you get the same error when running in Development mode? [I confess I didn't try my little routine in an Executable ...].
Bob Schor
09-16-2019 06:13 AM - edited 09-16-2019 06:21 AM
I'm sorry, i thought the image would be enough...
I did what you said and if i run a VI it completes normally, no errors or anything.
However when i build it to an executable i get this error:
I also added a VI(s) in question and document template.
As said, when i run VI it completes OK, but when i run an executable i get the above error. Changing functions from NI_HTML class to NI_WORD class didn't help, they just get switched back during building.
Edit: The error in my original post was taken from executable application ran on machine from production, the second one was made on my computer, thus a bit of a difference.
09-16-2019 08:33 AM
The problem with the executable is that the classes for Excel and Word are loaded dynamically. This means you have to explicitly add them to the project and "Always Include" them in the executable. How did you try adding the classes to your project? I know I have done this (back in LabVIEW 2012, but it should still work).
09-17-2019 03:12 AM
Found a similar thread from 2010 and turns out i was trying to add these files in a wrong way (due to weird description on support page)
Managed to add them now and it works.
Thank you all for help.
06-27-2022 08:50 AM
Could you please comment a link to that 2010 forum, I'm running into a very similar issue. Thank you!
06-27-2022 10:39 AM
In 2012, I posted a Revised "Generate Excel Report" Example in the Forums. I just downloaded that (old) code, put it in a Project, and built an Executable without doing anything "special", just copying the Top Level VI ("Excel Demo") to the right side for the Build.
Of course, it worked, but threw an Error! Stupid me, I specified an "Invalid Path" for the output file (step 13). When I replaced the "Strip Path" function and its input ("Application Directory") with "Get System Directory" with input "User Desktop", it worked perfectly, and showed the expected Demo Spreadsheet.
I'm running Windows 10 (64-bit), LabVIEW 2019 (32-bit), and the current version of Office. This should, I hope, also work for you.
Bob Schor