LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
himiag

Custom table column widths in Standard Reports

Status: New

My request is very much similar to Rob Hingle's request posted in "Need custom column widths in Append Text Table to Report" thread here:

 

http://forums.ni.com/t5/LabVIEW/Need-custom-column-widths-in-Append-Text-Table-to-Report/td-p/110840...

 

I discovered the above thread while looking for a solution and I got very disappointed that the discussion in that thread did not lead anywhere...

Rob actually said it all; I can only second him here as my problem is basically the same. Nevertheless, I'm putting it out here for reader's convenience.

 

In my practice, I often need to create a LabVIEW standard report (for printing on paper) which would contain, among other things, one or more tables. The tables must have columns of different width. Some columns need to be just a few characters wide, while some other columns have to be quite wide. For example, a table of chemical compounds would contain a Sequential number and a Compound ID, and a few other columns. The first column needs to be three characters wide maximum, while the Compound ID has to be much wider (say, 30 characters wide). There is no way I can use the standard LabVIEW "Append Table To Report.vi", since it sets all the table columns to be of equal width. In the past (LabVIEW 7) I was able to do this by modifying the "Append Table To Report.vi" and its subVIs so that the VI would take an array of column widths instead of a single scalar value. It became quite difficult to achieve since NI reworked the Report Generation Toolkit... I ended up importing and using the old toolkit - now with LabVIEW 2010 and 2011, which is obviously not the best solution.

 

I'm surprised that this issue apparently did not draw more attention so far, since IMHO it's been a glaring deficiency of the Report Generation Toolkit for some time now. Why the Report Generation Toolkit was designed with the assumption that columns in tables can only be of equal width is just beyond my understanding... Generating printed reports with tables is a quite common task, and most of real-world tables have columns of different width - just take a look at a few tables in books, magazines, manuals... A table with columns of equal length is quite a special case of more generic form, and can be easily obtained if needed by specifying the same width for all columns in the table.

 

Please make the "column width" input of the "NI_report.lvclass:Append Table to Report.vi" an array... To provide backwards compatibility, the VI can be made polymorphic (I hope), so that either an array or a scalar could be used.

 

6 Comments
lvABC
Member

I would even consider Auto Width Option too.
Where it would calculate width from max length of the column element and add some whitespace border.

JenWAB
Member

Has anyone else come up with a solution?  I have dug into the code some and it looks quite complicated to add the functionality to individually set with column widths.

JudgeMental
Member

I found that I can set different column widths by modifying the "vi.lib\Utility\NIReport.llb\Win\Set Table Column Width.vi". In the "Set Table Column Width.vi" block diagram, I disconnected the Column Width scalar, and created an array constant that is auto indexed at the for loop "width" input..This works, but is a constant array. So all my reports  have these modified column widths. NI should change this to allow the array to be passed in from parent levels up, originating at the "Append Table to Report.vi".

JamesEdward
Member

Late reply to this, but I hope I can help someone with the same issue.

 

If you change the default value of "column width (1)" to -1 in "NI_report.lvclass:Append Text Table to Report (wrap).vi", it will skip the column-editting case structure found in "NI_ReportGenerationToolkit.lvlib:Excel_Insert_Table.vi".  This means that you can print with the column widths saved in your Excel file, rather than LabVIEW changing them all to a constant width.

 

VI  Heirarchy:

NI_Report_GenerationToolkit.lvlib:Excel Easy Table (str).vi

NI_report.lvclass:Append Text Table to Report (wrap).vi

NI_Excel.lvclass:Append Text Table to Report.vi

NI_ReportGenerationToolkit.lvlib:Excel_Insert_Table.vi

jsietz
Member

Thanks J.E. never late, helped me tons...

2014 sp1 Append Table to Report "-1' for columns; and now my template columns are maintained...

Karan1
Member

Hi,

You can do that in LV 2020 by using the Word Set Table Dimensions option to input an array of size equal to number of columns and elements containing the respective column sizes you want. Also, keep input "Fit to page width" as False.