LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Help!I want to transform data in txt file into excel in LabWINDOWS,how can I do ?

for example,I want to transform the data in txt file of ATTACHFILES into excel file.Help me!thx!
0 Kudos
Message 1 of 11
(4,594 Views)
There is a couple of solutions for your problem:

By saving a txt file seperated by commas as a text file with a .csv extension automatically opens in excell without conversions as cell entries. Excell has a built in functionality associated with csv.

Secondly you can use activeX:
See your CVI documentation on : ActiveX Examples, there's a good example doing that.

Then there's a routine written by Written by Ori Idan in March 1998 to do it through the Excell .dll (See attachments)

and another by an unknown author (cannot recall his name) that was published on the CVI email forums site that was disbanned. (Welcome2.cvi)

There is good working examples in the attached project files.

My preference is to write files in CSV format and then t
he next option would be writing native Exell formats.

Hope this helps.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
Download All
0 Kudos
Message 2 of 11
(4,595 Views)
You can use Active X - see the CVI help files and samples on that under ActiveX Examples section.

You can also simply save the file as a text file with the values seperated by commas and naming the file something.csv. Excell recognises this format and opens every comma seperated field in a new cell.

There is documents (sparse) and good working examples included.

You can also try these tools contributed by developers to the CVI community. Unfortunately that site went down and is now only available on my PC. The source is very small so see my attachments.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
Download All
0 Kudos
Message 3 of 11
(4,595 Views)
Thank you very much!But I can't run the example'Access Excell through a.dll',project link errors,Aborted load of library "...\CVI70\sdk\lib\Shell32.lib".
0 Kudos
Message 4 of 11
(4,595 Views)
and I want to transform many txt files into one xls files.I think it isn't very easy.:(
0 Kudos
Message 5 of 11
(4,595 Views)
It's possible the Windows SDK was not installed on your machine. You have to enable this setting on installation of CVI, and you have to be using CVI Pro. There are examples though that come with CVI that are different than the one posted. Go to NI Example Finder and search for "excel". There should be about 4 or 5 examples that come up.

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 6 of 11
(4,595 Views)
Hi,thank you ,my question almost is solved,but I have a query about "Array[3] = {0x00,0x00,0x00};
if(shade) Array[2] = 0x80;
if(fwrite (Array, sizeof(unsigned char),3, fp) != 3) return FALSE;" in Write files in native Excel format of ATTACH FILES,What action did Array[] have in all program?I know,it is a sign have or not a shade,but why not {0x00,0x80,0x00},just when {0x00,0x00,0x80},I have a shade.
0 Kudos
Message 7 of 11
(4,595 Views)
I believe that Array is how you define the properties of that cell, and by using that particular order of hex values, it changes the correct property from an enable to disable. I experimented by changing that Array[2] = 0x80 to Array[0] and Array[1], but those did not generate a shaded cell like Array[2] does. Also, 0x80 = 128 = 10000000 in binary, which gives me more clues that there is probably a single binary value that determines if a cell is shaded or not.

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 8 of 11
(4,595 Views)
You have known the Why?I think,you have a clue,but didn't know true reason?Right?Maybe it referred to basic definition in Excel.Thank you,it is best if I could contact with expert on using excel in LabWINDOWS.:)I hope can hear new idea from you about this question.
yxw_zju@hotmail.com
0 Kudos
Message 9 of 11
(4,595 Views)
Hi,

Ideally, you would want to find out more on C programs that interact with Excel to learn about this property and array. The reason is this code is not really CVI specific in that you can develop a similar application in Visual Studio, but still end up with a similar question. I would suggest talking to either Microsoft or somebody that has extensive knowledge in C programming with MS Office to learn more about this particular subject. As for other CVI related questions, I would be more than happy to help you in that subject. Have a nice day!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 10 of 11
(4,595 Views)