LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

excel: open file/ insert line/

hello,
I'm using Labwindows 8.1.1 and I would like use Excel with it.
Could you say me where I can find Excel instruction help (with lot of details)
How I can open existing file (always the same) and How I can insert a line in this file.
How I can insert new sheet, and execute some macro.
Thank for your help
Delphine
0 Kudos
Message 1 of 6
(4,652 Views)
Hi Delphine,
 
I recommend you to use the ExcelRpt library (excelreport.fp). It has all the functionality you need.
The library is in <CVI installation directory>\toolslib\activex\excel
You can see the sample in <CVI installation directory>\samples\activex\excel
 
You can search this forum for the keyword "ExcelRpt" to be aware of some pitfalls beforehand.
Hope this helps.

Message Edited by ebalci on 07-02-2007 02:02 PM

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 6
(4,650 Views)

thanks you for your help,

I have another question, exemple:

ExcelRpt_InsertRow

HRESULT ExcelRpt_InsertRow (CAObjHandle worksheetHandle, int insertBeforeRowIndex, int numberOfRows);

could you explain me what is CAObjHandle? this is my excel file name? I don't understand what is it.... I'm sorry 😉

 

0 Kudos
Message 3 of 6
(4,644 Views)

Hi,

CAObjHandle is a type name. Just like a char or double. But it is actually an alias. In some .h file it is defined as an alias name to the well-known type int.
So practically it stores an integer value.

Functionally, it is a "handle".
It is NOT a file name. It is more like an ID number.
Once you obtain one, you can use it whenever you want to refer to a specific object within your program. This object may be a worksheet, a workbook or even the currently open Excel application itself.

For the function you asked it is a "handle" you should have obtained before you call that function. For this purpose you can use one of the following functions, whichever suits your application better: ExcelRpt_GetWorksheetFromIndex or ExcelRpt_GetWorksheetFromName.

Hope this helps.

Message Edited by ebalci on 07-03-2007 07:53 AM

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 6
(4,624 Views)

thanks for your help, I understood what are CAObjHandle, ExcelObj_Line etc...

I finally use excel200.fp, because there is more exemple with this file. I open new file, select the good sheet but when I try to insert line with HRESULT CVIFUNC Excel_LinesAdd (CAObjHandle objectHandle, ERRORINFO *errorInfo, double x1, double y1, double x2, double y2, ExcelObj_Line *returnValue) the return value is an error because I don't know what is x1,y1,x2,y2

I made some test with different value but the error value is always here

Have you got any idea about it?

thank

delphine

0 Kudos
Message 5 of 6
(4,602 Views)

For the function you have asked there is not a corresponding function in ExcelRpt library, but I suppose x1, y1 and x2, y2 are start and end point coordinates of the line you want to add. Here, "line" is a drawing object, like the ones you draw with a pencil Smiley Wink

Are you sure this is what you want/need?

note: Generally speaking, I strongly recommend you using the ExcelRpt library, if it has what you need.
ExcelRpt is pretty satisfactory in terms of completeness, it is much easier to use and best of all it is documented.
Its function panels have built-in help.

S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 6
(4,585 Views)