From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate an excel file?

Solved!
Go to solution

Hi all;

 

So i've a project to finish ASAP, but i still bloqued;

Actually i've to read data from a com port and then to load these informations in an excel file means that i'll create and then generate an excel file;

i still bloqued on excel, no advancement on that point,

Can some one help me;

Thks by advance;

 

Kindest regarda;

 

0 Kudos
Message 1 of 38
(4,309 Views)

CVI comes with an interface to Excel (as well as other programs that can communicate via ActiveX). You can search the sample program via the example finder: just looking for "Excel" should point you to the correct sample (it should be located in <sample program folder>\activex\excel or something similar: I cannot verify at the moment as I don't have CVI installed on this machine).

 

The sample program demonstrate various ways read/write data in an Excel sheet and should give you a framework for you to develop your own application. Please note that full Excel program must be installed on the target machine (no possibility to link to Excel starter edition, as it lacks the ActiveX interface).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 38
(4,302 Views)

Forgot to say that there is also a "Escel report" instrument that you can find within CVI installation: it is built on top of the previous module I mentioned so I normally don't use it but you may want to search documentation about it and consider to use it.

 

Don't forget to look in the forums as well as NI support site, where you can find a lot of resources and documentation about this argument.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 38
(4,304 Views)

Please study the sample project "excel2000dem.prj" come with your LabWindows/CVI, especially the functions "LaunchApp(...)", "NewAppFIle(...)", "SaveAppFile(...)", "WriteDataToExcel(...)", and "ShutdownExcel(...)" in "excel2000dem.c" file.  You'll gain a lot of insight for using Excel with CVI to achieve what you want to do.  Let us know if you encounter any problem. 

0 Kudos
Message 4 of 38
(4,283 Views)

So, i'm back;

I stil not sliving that project...

I need to create an escel file containing many sheets, and every seceont i've to verify if it exists or not:

if no i've to create it, if yes i've to open it to write datas ...

I succeed to create that file and wirte data s wanted, but with files functions means fprintf, fscanf ..., but the problme here that i can't succeed to create many sheets, if i can do it it'll be perfect 

Spoiler
Smiley Happy
Spoiler
For the excel functions, i can't do it well, still not so clear for me all those functions;
Spoiler
Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Spoiler
Spoiler
Smiley Sad

 

0 Kudos
Message 5 of 38
(4,152 Views)

Smiley Happy Is there some one here??? Hiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

0 Kudos
Message 6 of 38
(4,148 Views)

ouppssssssssssssssssssssssssssssssssss,

Think there's no one to help;

Have to still thinking alone Smiley Sad

0 Kudos
Message 7 of 38
(4,137 Views)

Hello touha,

you already had some suggestion from dcl9000 and myself about this problem. CVI comes with a great Excel example that may give you a basic framework from which to start developing your application.

Have you tried looking at it? Did you find any specific problem in using it?

There are alco several forum threads that address communication with Excel that you may want to search.

 

Regarding the presence / absence of the file, you can use FileExists () function from the Programmer's Toolbox.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 38
(4,132 Views)

2548976512554 thanks best ROberto 

Ok for the (fileexists), i've already use it for te example i develop using the file's functions,

Honestly, i look for excel examples, but he biggest bloquant pt is how to identify the wanted file (if u look all excel functions don't let u specify a specific file name...);

Looking my modest knowledge about excel functions on LBw, i can't advance any more Smiley Embarassed

But, let us back for file's functions, i can't cearte excel file with many sheets????

Hope u can sunshine some light on that issue Smiley Frustrated

0 Kudos
Message 9 of 38
(4,131 Views)

Take a look at excel2000dem example: the function openAppFile shows how to open a given existing file, specified in fileName variable:

 

                // Open existing Workbook
                GetProjectDir (fileName);
                strcat(fileName, "\\exceldem.xls");
                error = Excel_WorkbooksOpen (ExcelWorkbooksHandle, NULL, fileName, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, &ExcelWorkbookHandle);

 

Just to be clear, the example we are referring to is this one.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 10 of 38
(4,127 Views)