LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Could someone explain how to use the NIReport_TableGetColWidth() and NIReport_TableSetColWidth() functions with LW/CVI?

I tried adding NIReport_TableGetColWidth (hreport, 1, &width); to the ConvertTableButtonCallback in the NIReports NIConvertSample project but CVI reports an error of NIR_ERR_NotInTable (-18) on any column values I ask for or try to set.

NON-FATAL RUN-TIME ERROR: "nirconvertsample.c", line 62, col 13, thread id 0x000007C0: Function NIReport_TableGetColWidth: (return value == -18 [0xffffffee]).

My goal is to be able to adjust the column widths on a table I am printing. Currently the column widths are all equally spaced yielding tall rows of information. I want to be able to set each columns width individually.
0 Kudos
Message 1 of 5
(3,540 Views)
The way the tables work in NIReports is that you call the TableStart function, you format the table, and then you call the TableEnd function. Once you have called the TableEnd function, the table cannot be edited. The high-level function CVI provides for converting a CVI table to a NIReports table does NOT leave the table open so you can't change the properties of a converted table. If you would have run the GetErrorString function on the error you were getting, -18, you would have seen that you are getting a "Table Not Opened" error. Your two options would be:

1) Change the column width of the CVI table before you convert it. You could change it back after.

2) Don't use the convert function and build the table yourself from the NIReport lower leve
l functions. A much more time consuming approach.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,540 Views)
I could see that Error -18 meant 'Table Not Opened' but had nothing to reference on what that meant.
The documentation in the FPs is rather light in content, there's nothing to reference that pulls it all together.

I have not been able to utilize your suggested option #1.

In the NIConvertSample() you can change the width of the columns on screen by dragging the column line(or programmatically via SetTableColumnAttribute()) but I can't see any visible change to the Report in Column Widths, only on the screen.

Option #2 is possible but as you said more time consuming.

Thanks
0 Kudos
Message 3 of 5
(3,540 Views)
I assumed that the Convert function referenced the table column sizes, but I guess I was wrong. It looks like it defaults the columns to evenly spaced widths across the page width.

It looks like you would have to go with the more arduous option #2 to get custom column widths in the table.

Chris
0 Kudos
Message 4 of 5
(3,540 Views)
Bummer.

Thanks for the clarification.
0 Kudos
Message 5 of 5
(3,540 Views)