04-04-2019 08:28 AM
Hello,
I am using the Report Generation Tool Kit to generate a Word document in a sub vi. The vi will initially prompt the user for some information and then it populates the report, ask the user to save, then closes MS Word. The code works perfectly in development, but when I build it into an executable, it does not launch MS Word, nor will it populate the data. I also do not see any error messages unlike other people who have encounter this issue.
From my research, I gathered that "NI_Word.lvclass" needs to be included in the project for it to work. However, the instructions on how to do that does not match what I see in the menus. Specifically, "NI_Word.lvclass" is not listed under the "Source files" tab in build dialog (see attached screenshot). Any help will be appreciated. Thanks.
Software versions:
LabVIEW 2017
Word 2013
Relevant links:
http://zone.ni.com/reference/en-XX/help/372120A-01/lvrgthelp/rgt_stand_alone_apps/
Solved! Go to Solution.
04-04-2019 08:58 AM
You don't use any of the Word specific VIs so the word class is excluded from the build. I would just add a Word Get ActiveX References VI at the beginning of your generation code and then rebuild your EXE. This should be enough to get the right dependencies included.
04-04-2019 09:20 AM - edited 04-04-2019 09:21 AM
@aputman wrote:
You don't use any of the Word specific VIs so the word class is excluded from the build. I would just add a Word Get ActiveX References VI at the beginning of your generation code and then rebuild your EXE. This should be enough to get the right dependencies included.
I guess I would do this, too.
-----------
How to get this to work:
http://zone.ni.com/reference/en-XX/help/372120A-01/lvrgthelp/rgt_stand_alone_apps/
From the Source Files page of the Application Properties or Shared Library Properties dialog box, navigate to and select the class files you added to the project. Click the right arrow button next to the Always Included list to add the class files to the application.
I manually copied the file
"C:\Program Files (x86)\National Instruments\LabVIEW 2017\vi.lib\Utility\NIReport.llb\Word\NI_Word.lvclass"
..to the directory where my .lvproj is. Then drag and dropped this to the .lvproj - which will indicate a warning.
Then "NI_word.lvclass" shows up in the Source Files menu, and you can add it via Always Included.
04-04-2019 09:47 AM
Thank you aputman, it works now.
04-04-2019 09:50 AM
I tried your method, but I cannot drag and drop "NI_Word.lvclass" into the ".lvproj" file. Maybe I am misinterpreting your instructions?
04-04-2019 09:58 AM
@OhmsLawyer wrote:
I tried your method, but I cannot drag and drop "NI_Word.lvclass" into the ".lvproj" file. Maybe I am misinterpreting your instructions?
did you try to add the original file or did you try to add a copy of that file ?
strange, but nevermind, you solved your problem already 😉
04-04-2019 10:07 AM
did you try to add the original file or did you try to add a copy of that file ?
I made a copy of the file into same folder as the .lvproj file. Then, I dragged and dropped it into the .lvproj file. But, it did not give me errors and does not seem to do anything at all. I also checked the source files tab to see if it is listed. It is not.
Thank you for your help anyway. It would have been nice to be able to manually add it without making changes to the VI.
04-04-2019 10:17 AM
Manually adding it like that doesn't work because it doesn't prevent the compiler from removing methods associated with the Word class from VI's such as Append Table to Report. If you double click to open one of these, you can select to open the Word implementation or the standard implementation. You have to force the issue by keeping the references in the code, otherwise the compiler will remove them completely.
08-26-2020 09:02 AM - edited 08-26-2020 09:03 AM
I have tried this method and am still unsuccessful. I am trying to create a basic word report (no template) and always fail the "create report" step due to the executable not being able to locate the NI_Word.lvclass file. I have added that file to the source files and included in the "always included" section of the build but it doesn't seem to have any impact on the error. Has anyone else run into this?
I am using labview 2018 and am testing the application on the same computer as development now (to remove any conflicts of MS word versions).
08-26-2020 10:05 AM
You should not need to Always Include the word class. However, the Create Report is not enough to force the dependencies to be included in the build. You need to use a Word Specific VI to have it pull the proper dependencies. At a minimum, if you drop the VI "Get ActiveX References", this should be enough to make the build work properly.