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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

There is a macro which generates table box dynamically.How do I change the presentation (alignment) of the table box dynamically?

How do I change the alignment of the data of table box and the header ?

sub test1234

Dim tb

Set tb= ActiveDocument.GetSheetObject("TB124")

set clus1 = ActiveDocument.Variables("Vbranch_Z")

clus = clus1.GetContent.String 

tb.removeField(1)

tb.removeField(0)

tb.AddField "ORDER_KEY_" & clus

tb.AddField "Clus_input_" & clus

set tbp = tb.GetProperties

set cols = tbp.Layout.ColLayouts

cols.Item(0).Label.v = "Name"

cols.Item(1).Label.v = "ID"

tb.SetProperties tbp

End Sub

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

From the API Guide:

set mybox = ActiveDocument.ActiveSheet.CreateTableBox

mybox.AddField "Class"

mybox.AddField "ClassComment"

set tbp = mybox.GetProperties

tbp.Layout.HeaderMultiLine = 2

tbp.Layout.ColLayouts.Item(0).LabelVerticalAdjust = 4    'center

tbp.Layout.ColLayouts.Item(0).LabelAdjust = 1    'center

mybox.SetProperties tbp

View solution in original post

3 Replies
m_woolf
Master II
Master II

From the API Guide:

set mybox = ActiveDocument.ActiveSheet.CreateTableBox

mybox.AddField "Class"

mybox.AddField "ClassComment"

set tbp = mybox.GetProperties

tbp.Layout.HeaderMultiLine = 2

tbp.Layout.ColLayouts.Item(0).LabelVerticalAdjust = 4    'center

tbp.Layout.ColLayouts.Item(0).LabelAdjust = 1    'center

mybox.SetProperties tbp

Not applicable
Author

This code snippet is helpful in making the Label Center Justified. I want to make the data within these labels center justified,ike the numbers 1, 2,3(i. e. the data within the column ID center justified.And Also How do i increase the size of the table box from default.Could you please guide me on this.

Not applicable
Author

set tbp = tb.GetProperties

set cols = tbp.Layout.ColLayouts

cols.Item(0).Label.v = " ID"

cols.Item(0).ColWidth = 500

cols.Item(0).LabelVerticalAdjust = 4

cols.Item(0).LabelAdjust = 1

cols.Item(0).NumAdjust = 1

cols.Item(1).Label.v = "Name"

cols.Item(1).ColWidth = 500

cols.Item(1).LabelVerticalAdjust = 4

cols.Item(1).LabelAdjust = 1

cols.Item(1).TextAdjust = 1

tb.SetProperties tbp

I could solve the problem by your suggestions .I used API Guide as well.