LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Saving an Excel File Using Template in Report Generation Toolkit

Solved!
Go to solution

 

Hi everyone,

I’ve been encountering an issue while trying to save an Excel file using a template in the **Report Generation Toolkit**. For context, I’m working from one of the provided examples, and all I did was change the name of one cell to test it, but for some reason, the value in that cell won’t update, and I keep getting the following error:

```
Error -41110 occurred at NI_ReportGenerationToolkit.lvlib:ex_RGT_Append Anything To Report.vi -> NI_ReportGenerationToolkit.lvlib:subMS Office Report Block.vi -> Untitled 3.vi -> Excel Report - Generate from Template papo furada[o.vi

While processing the input.

Possible reason(s):
Report Generation Toolkit: You specified invalid Word bookmarks or Excel named ranges.
```

I’ve **double-checked** the name of the cell in the Excel file, and it’s correct, but the program still won’t accept it. I even tried renaming it several times, but nothing seems to work.

Here are some additional details of what I’ve tried so far:
1. I followed the example exactly, but I changed one cell name in Excel, hoping to see the change reflected when the report runs.
2. The template is being processed correctly, but when it reaches the part where it should modify the value in the renamed cell, the error appears.
3. I’ve confirmed that the name in the Excel template matches the string I’m referencing in LabVIEW.

Has anyone encountered a similar problem with named ranges in Excel templates when using the toolkit? Or am I missing something small that’s preventing this from working?

Any help or pointers would be greatly appreciated! Below are examples of the exact steps and changes I made if it helps diagnose the issue.

 

Edit. the exel that I use in this text is the same as the exemple "Exel Report - Generate From Templat.vi
and I just try to rename a cell in "teste" and than the probleem star 

0 Kudos
Message 1 of 10
(404 Views)

How are you renaming the cell in the Excel template? And can you confirm that the named cell is properly listed in the Name Manager (available on the 'Formulas' ribbon)?

 

name_manager.png

0 Kudos
Message 2 of 10
(361 Views)

Yes, I’m certain that the cells were renamed. Attached is a screenshot of the control for reference.

MarcusP_0-1727204420664.png

 

I managed to get rid of the error by changing the template type, but now nothing happens. The error is gone, but the cells aren’t being updated, so I'm not sure what's going wrong at this point.

0 Kudos
Message 3 of 10
(350 Views)

I don't know what the problem could be. I updated the .xlt template file to contain the exact same named cell as shown in your screenshot, I ran your VI, and the cell was updated properly.

 

teste.png

0 Kudos
Message 4 of 10
(336 Views)

Hello, Marcus.

 

     Shortly after I started to learn LabVIEW, I was introduced to the Report Generation Toolkit (it might have been a LabVIEW 7 toolkit -- we hadn't upgraded to LabVIEW 8 yet).  By the time I got around to writing my own code (rather than learning by trying to patch and maintain old code), we were in LabVIEW 12, and (as you did) I tried to learn "how to" by following the examples shipping in LabVIEW.

 

     I didn't like them, found them confusing, difficult to learn from, and so decided to write my own, which I put on the Forums about 20 years ago.  It does not use Templates, but does show you how to create something that could have been created by "filling the blanks" on a template.  You can find it by going to the Forum's Search Bar on the first page and typing (pretend there are quotes here) Revised "Generate Excel Report" Example (another quotation mark here).  I've found that if you type "Revised Excel " and then stop, it will find it.

 

More recently, I have built "Excel Templates" (nothing quite as fancy as the NI Example) for myself and my colleagues who want to analyze data using Excel.  Since I am not, myself, an Excel Expert, I don't use "named cells".  But I do create Worksheets that will go in the final Excel File, with headers (where appropriate) for Rows and Columns (most of the data are in rows, so the columns have headers).  I also have a Worksheet called "Parameters" where I store parameters I want to use when processing the data (in order to put them in the correct column), as well as Excel addresses to tell me which Cell should be used as the "anchor" cell for the data (by "anchor", I mean that if I'm saving a 2D array of data, I want the Excel address, e.g. F2, of the upper left entry).  For example, I'm looking at a Parameters section that looks like this:

Parameters WorkSheet.pngI don't quite remember what the experiment was that used this code -- something about training mice to discriminate "touch" with their whiskers and lick (or not lick, as the case may be) a water bottle for a "reward" (water) or "no reward".  I do recall that for a trial, a quantity of interest is when, after the "Go" or "NoGo" command were given, licks occurred (and we used Excel to create a histogram by binning licks in 125 ms bins (see Bin Width, above) from 2 seconds before the Trial to 3 seconds after (times are in milliseconds).

 

The code to do this definitely looks like LabVIEW, not Excel, because I "hide all the Messy Details" inside sub-VIs that do all the work.  The "Revised Example" I mentioned above, however, just lays all the steps out in the open, with explanations for each of them.   

 

One final recommendation -- when using the RGT, notice that there is both a set of VIs on the "main" page of the RGT Palette (with the colored top of the icons).  Other than Create Report, Save Report to File, and Dispose Report, I use none of them -- instead, I use the Excel-specific files (including the Excel Easy functions, which I find much more useful and powerful.

 

Bob Schor

0 Kudos
Message 5 of 10
(316 Views)

This just don't make any sense, I am trying to make this work, for some time, but why in my case, it just dont work

MarcusP_0-1727348537544.png

this is the error that i get

0 Kudos
Message 6 of 10
(285 Views)

Edit. I think that this is so easy to solve, but I just can't understand why this keep happend 

MarcusP_0-1727358983949.png

and this just make me re-think my hole life ...

0 Kudos
Message 7 of 10
(259 Views)
Solution
Accepted by MarcusP.

I was able to get things to work by making my own edit to the .xlt file, and also updating the path in the code to point to the .xlt file to which I added the 'teste' named cell.

If you're still having trouble, perhaps you could share the exact code and exact template you're having issues with? Meaning, attach the .vi file you are editing and the .xlt file you are editing to a reply on this thread? Clearly something is different between the manual changes I made to get the named cell to work, and the way in which you've edited your .xlt file.

Message 8 of 10
(242 Views)
Solution
Accepted by MarcusP.

In using the RGT, the term "Template" (as in the Template file you can use as a "Fill-in-the-blanks" input to the Create Report function is not the same thing as an "Excel Template" (.xlt) in "Microsoft terminology".  Rather it is an ordinary .xlsx file, created by Excel (or by the RGT!) that you will read, "pre-filling" in the blanks on various WorkSheets, and allowing you to have a starting Workbook that you can populate with data on WorkSheets that you have already created on the Template.  You don't have to have a Template file -- you can use the RGT to generate multi-WorkSheet Workbooks, and, indeed, you can generate the Template File itself with the RGT.

 

Bob Schor

Message 9 of 10
(226 Views)

Got it, I finally made it work!

The issue was that, when I was saving the file, the extension was changing for some reason, and it wasn’t the same extension as the original template. Because of this, I was getting the error when trying to use it as a template for my application.

Thank you very much to everyone who helped!

0 Kudos
Message 10 of 10
(217 Views)