02-19-2015 04:11 PM
I would like to merge portions of two Excel files using LabVIEW. I am using LabVIEW 2012 and Excel 2010. In my attachment, I want to merge rows 1 and 2 from the Excel 1 file with rows 3 and 4 of the Excel 2 file. The desired result is shown in the Excel 3 file. Any help will be greatly appreciated.
02-19-2015 08:13 PM
Where is attachments?
Use Report Generation Toolkit (RGT) & read your required data (file-1 & File-2) and merge it (using array functions)
After that write it into other excel file.
If you don’t have RGT, use ActiveX functions to read your excel files.
02-20-2015 07:58 AM
Which RGT VIs would you use?
02-20-2015 08:19 AM
02-20-2015 09:58 AM
Thanks. This example will allow me to merge the data in the two excel files. However, I would like to also reproduce all the cell formatting from the original files (cell borders, shading, etc.) Sorry, I didn't mention this before. Can this be done with the Report Generation Toolkit or do I have to use ActiveX?
02-20-2015 10:03 AM
Yes.. you can do that.
Just check RGT vis for the same (Excel format vis). If your facing any problem, post your VI.
02-21-2015 03:32 PM
The "problem" with the (otherwise very nice) Excel Format VIs is they are only "Set XXX", without the corresponding "Get XXX". If you know in advance the formats of the cells you are merging, you can apply them when you write the data back out (it will be much easier to do this if you can work in "blocks" of cells, such as entire rows, entire columns, or the entire sheet, rather than format cell-by-cell). On the other hand, if you do not know the format, and want to "copy" it from the cell/row/column/sheet that you read, I suspect you'll need an ActiveX call to get this information.
Bob Schor
02-23-2015 07:51 AM
I agree. Can you recommend a knowledge base artical, etc. where I can begin to educate myself on the ins and outs of ActiveX?
02-23-2015 09:37 AM
Well, I can tell you that the last time I did serious work with ActiveX/Excel for LabVIEW, I was running Windows XP, which gave me access to the Office 2007 ActiveX Help, where there was pretty good explanation of the calls and uses of ActiveX. Since then, I think Microsoft has (maybe "abandoned" is too strong a word) "de-emphasized" ActiveX -- I had a lot of trouble getting similar Help screens for Office 2010 on Windows 7 (indeed, I kept my XP machine around until a few months ago, and turned it on if I needed ActiveX Help).
There is, still, the Web ... However, this is not a particularly "user-friendly" API.
Bob Schor
02-23-2015 09:45 AM
What I think you (and others, myself included) are trying to do is to use LabVIEW to "work with" Excel, to be able to read, modify, and write Excel WorkBooks. However, I think the model that NI has for the Report Generation Toolkit is summed up in the name of the Toolkit, "Report Generation", i.e. a "Write-Only" application, where you (necessarily) develop and decide all of the design criteria yourself. Note that there is scant provision for reading an Excel Workbook (which works perfectly well, by the way) -- they only speak in terms of a "Template", which I think they intend as a "Boiler Plate" with pre-defined Sheets and possibly Headings.
I've filed an Idea for NI to add "Get" Format and Graph functions to complement their "Set" functions (and provide the information you want). If you like this Idea, vote for it here.
Bob Schor