LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with Report Generator

I've recently installed and started to learn the the Report Generation Toolkit for Microsoft Office verion 1.1.1.  Currently I have a program that collects data and saves it in a txt file.  I have a template set up in excel where I would like to read from a specified txt file and have the data printed in the appropriate columns.  I've grasped the idea of named ranges and bookmarks but how do I get the data to print the way I want.  I've attached a few pictures to give an idea of what I'm working with.  The vi gives a general idea of how the file is created in the main program.  The excel file (example) shows part of the template, the numbers under the "Actual Test" column is what I would like to see imported from the txt file.  I'm unsure if I need to change the way the original data is saved but I'm open to any and all suggestions.  I'm using LabVIEW 8.2.
 
Thanks.
LabVIEW 2016 - Windows 7

CLAD
Download All
0 Kudos
Message 1 of 5
(3,046 Views)

Is there any reason you need to generate the text file first, then read from it to get the data into Excel?  Why not just send the data to Excel directly?  In order to get it in the .xls file in a nice way, you should probably use Named Ranges in Excel, to define the range in the spreadsheet where you want the data inserted.  I've attached a VI that does that to this post.  There is a named range of 5 cells in the spreadsheet called NR_data, and the VI simply inserts the data into this position in the spreadsheet.  You can also take a look at the example VI that ships with the toolkit located at [LabVIEW]\examples\office\Excel Examples.llb\Generate Report From Template (Excel).vi to see a more complicated example.

Let me know if you have any further questions.  Good luck!

-D

P.S. - Detach the VI and the .xls file into the same folder and then run the VI.

Download All
0 Kudos
Message 2 of 5
(3,030 Views)

Thanks for the reply.  Unfortunately I’m still unable to get the desired result.  Let me elaborate on what I want to accomplish.  The data collection and analysis is done by the main program.  All the data is saved as text files.  Most files are fairly simple, just a column header and a single data point for each column.  Ultimately I would like to build a program using the functions in the Office Report Generator.  I have three templates set-up in Excel and want to be able to pull the necessary data from the text files and import them to the correct location.  I’ve experimented with named ranges with the MS Office Report Express VI.  When I format the data as an array I get a table.  I would like the numbers just as they are under the Actual Test column.  Any suggestions?

LabVIEW 2016 - Windows 7

CLAD
Download All
0 Kudos
Message 3 of 5
(3,011 Views)

Hello,

Your requirements for the appearance of the template are a little too advanced for the MS Office Report Express VI.  Its purpose is very specific...it will append tables that have indexed values (which is why you see the extra 0,1,2,3,... column in your report).  I have attached a VI that uses a few of the Report Generation VIs from the palette to accomplish what you want.  I've also attached a modified Excel template.  You need to format the cells in the Excel template to appear exactly how you want them...so I changed the formatting of the Setup column cells to match exactly the format of the "Actual Test" cells...specifically, Numerical formatting with either 1 or 3 significant digits.  In the attached VI, I set the font size to be '12' (to match the font size in the template cells), and then I pass the column into the spreadsheet via the Append Table to Report VI.  In addition to attaching the VI itself, I've also attached a screenshot of its diagram here:

I hope this makes sense...also, you should see that this code is similar in structure to the code in the "Excel Report Generation VIs" case of the "Generate Report From Template (Excel).vi" example I referenced earlier.

Good luck,
-D

Message Edited by Darren on 12-08-2006 03:54 PM

Download All
0 Kudos
Message 4 of 5
(3,007 Views)
Looks like I'm in for a lot of learning.  Thanks for giving me a base to build off of.  Much appreciated!
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 5 of 5
(3,003 Views)