LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

file system

i have to accomplish the task of file reporting using LabWindows. For this purpose i m referring the example named "word2000demo.c" of Labwindows. To a certain extent it is meeting up my requirements but unlike the uniform table generated through this example, i have to have a table in which there are 2 coulmns in the first two rows and 5 columns in the remaining rows of the table but i cant figure out how to achieve this. Plus, the arguments of the function AddRowToTable (currSelHandle, resultsTableHandle, "000003", " 98.345", "33.0", "40.456", "0")); should be in the string format whereas the data i need to tabulate in the two coulmns of the table are the elements of integer type arrays (r may be structured data)on which i have to put a loop whereas the remaining three columns will have string type data. Does anybody have an idea of how to do this?
0 Kudos
Message 1 of 6
(3,705 Views)

To create a table with 2 columns in the first row and 5 in the next in Word, you create a table and then merge the cells in the first row.  Since the example "word2000demo.c" is built on ActiveX, we must go about creating the table programmatically the same way:

 

1) Create the table.

2) Select the cells to merge.

3) Merge the cells.

 

To do this, code must be added to the AddTableToDoc function, after the table has been created.  We then get references to the cells to merge with the Word_TableCell(table handle, error info, row index, column index, return) function, and then merge the cells with Word_CellMerge(cell handle, error info, merge to).  It looks like this:


    Word_TableCell (resultsTableHandle, NULL, 2, 1, &cellHandle1);
    Word_TableCell (resultsTableHandle, NULL, 2, 2, &cellHandle2);
    Word_CellMerge(cellHandle1,NULL,cellHandle2);

 

Note that you must declare the cell handles at the top of the block, and the indices of the table are not zero-indexed.  You would write empty strings into the cells that will be lost in the merge.  Additional documentation on the functions used above can be found at the Word Object Model Reference.

 

To convert integers into strings, you can use the sprintf() method, which is documented in CVI.  Then, you will write all five columns as string data as the function expects.

 

Regards,

 

Jen W.

Applications Engineer

National Instruments

ni.com/support

0 Kudos
Message 2 of 6
(3,666 Views)

Thank you so much Jen W for your help. Will do as u have said 🙂  and will need more of your assistance if any problem comes.

 

0 Kudos
Message 3 of 6
(3,643 Views)

My desired table has been created using the very same example. Now can anybody please identify what should be done in order to change the text color/font of certain rows in the table instead of the entire table? For instance how can i change the text color/ font of the first row in the table?

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

Hi easlk,

 

How are you changing the color of the text color/font? Most likely you will have to select the appropriate row using Word_SelectRow then set the text color/font.

 

I will try it out on my end and see as well.

Chris T.
0 Kudos
Message 5 of 6
(3,500 Views)

Hi Chris T.,

It is done 🙂
I have used WordRpt_SetTextAttribute in the function ResultsTableFillRow and this is how i am changing the text color/font of the row. And as i have to do
it for certain rows instead of the entire table, i created one function exactly like ResultsTableFillRow with the exception that it contains
WordRpt_SetTextAttribute and call this function for those rows. This is the only solution i could come up with. Not a good one but working
fine for me 🙂  Thanks for ur concern

0 Kudos
Message 6 of 6
(3,470 Views)