12-06-2006 02:51 PM
12-06-2006 04:24 PM
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.
12-08-2006 03:11 PM
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?
12-08-2006 03:53 PM - edited 12-08-2006 03:53 PM
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
12-08-2006 03:57 PM