Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get Column WIdth in Straight table

Using macro, how can i get a specific column width (for example, the width of column number 2) in a straight table.

there is a way of doing so in a Pivot table with the GetPixWidths function, but it's not working with a straight table.

Thanks 🙂

Refael

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Sub example2

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

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

expr.ColWidth = 250

chart.SetProperties p

end sub

View solution in original post

5 Replies
Not applicable
Author

try this in macro

sub example

set chart = ActiveDocument.GetSheetObject("CH01")

SET P = Chart.GetProperties

set expr = P.Expression.Item(0).DataExpressionVisual

expr.ColWidth = 120

chart.SetProperties P

end sub

note-- you can change the colwidth

er_mohit
Master II
Master II

Not applicable
Author

Tnx for your response.

Already tried that, but it's not working for me.

It throws an error in this row: " set expr = P.Expression.Item(0).DataExpressionVisual"

Not applicable
Author

Sub example2

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

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

expr.ColWidth = 250

chart.SetProperties p

end sub

Not applicable
Author

Thanks it worked 🙂

but when i try to get the ColWidth it returns a number which is incorrect.

for example, "msgbox(expr.ColWidth)" prints 400 when the actual number is 134

maybe it's in a different format?