Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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

Tags (1)
1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

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

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

3 Replies
mwoolf
Honored Contributor II

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

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

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

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

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

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.

Community Browser