Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Formatting the column width of a straight table

When creating a straight table, is it possible to manually set the size of each of the columns?  I know that it’s possible to manually set the X and Y position as well as the height and width of the overall object but I need to manually set the width of each column.  I have multiple straight tables in my document and I am positioning them so they all look like one table together.

Any help would be much appreciated.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

No, that's not possible. Maybe it can be done with a macro, but I haven't found where yet and I doubt it is possible at all.

edit: I did find something:

rem ** Double column width of column 2 in pivot table CH01 **

set chart = ActiveDocument.GetSheetObject("CH01")

pwidths = chart.GetPixWidths(1,1).PixWidths

chart.SetPixWidth 1, pwidths(0)*2

So there is a way doing it with some code.


talk is cheap, supply exceeds demand

View solution in original post

12 Replies
Gysbert_Wassenaar

You can change the column width with the mouse. If you hover on the right side of the column the mouse cursor will change to a double headed arrow. If you left click and keep the button down you can resize the column. Unfortunately there's is no way to set the column with for several columns at the same time afaik.


talk is cheap, supply exceeds demand
Not applicable
Author

I’m aware that it’s possible to change the column width by using the mouse.  What I’m asking is whether it’s possible to specify the width of each column, similar to the way you can do this by going to Properties -> Caption and then set the width for the entire table.  I have 5 straight tables and I have them positioned vertically on the sheet.  The intention is to make the 5 individual straight tables look like one table which is why I am trying to manually set the column width.

Gysbert_Wassenaar

No, that's not possible. Maybe it can be done with a macro, but I haven't found where yet and I doubt it is possible at all.

edit: I did find something:

rem ** Double column width of column 2 in pivot table CH01 **

set chart = ActiveDocument.GetSheetObject("CH01")

pwidths = chart.GetPixWidths(1,1).PixWidths

chart.SetPixWidth 1, pwidths(0)*2

So there is a way doing it with some code.


talk is cheap, supply exceeds demand

View solution in original post

Not applicable
Author

Thanks.  I'll give it a try.

jcfrasco
Creator
Creator

Thank you. This works very well.

Where can I find the properties for GetPixWidths to find out what the (1,1) refers to? I've managed to make it do exactly what I want by just playing around, but it would be good to see this along with other available functions.

Joao

Not applicable
Author

Hi Gysbert,

I am also in the same situation where I want to set width of all columns from one place. I am wondering where to add the script block you have specified.

Not applicable
Author

Hi ,

I develop this macro to help me to define the with of my straight table or any other graph. i hop eit help you.

sub Width

  set chart = ActiveDocument.GetSheetObject("CH03")

  set cp = chart.GetProperties

  set dims = cp.Dimensions

  dims(0).ColWidth = 10 'mettre ici la largeur souhaitée

  chart.SetProperties cp

  set expr = cp.Expressions.Item(0).Item(0).Data.ExpressionVisual

      expr.ColWidth = 200

     chart.SetProperties cp

     set expr = cp.Expressions.Item(1).Item(0).Data.ExpressionVisual

      expr.ColWidth = 200

     chart.SetProperties cp

     set expr = cp.Expressions.Item(2).Item(0).Data.ExpressionVisual

      expr.ColWidth = 200

     chart.SetProperties cp

end sub

cyruslentin
Contributor II
Contributor II

Hi Ejmal,

This seems interesting.

I am new to Qlik, How do I use the macro in a .qvf?

Not applicable
Author

Where in Qlik Sense would I enter this code?