Scripting: weird behavior when adjusting Pivot Table Column Widths

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Scripting: weird behavior when adjusting Pivot Table Column Widths

Ruben Geert van den Berg
Dear all,

I have a lot of pivot tables in a viewer document and I'd like all of them to have equal widths. However, something inexplicable is going on. When I assess the initial width of one pivot table and it's columns, I get the following:

THE PIVOT TABLE WIDTH = 459.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 39.
COLUMN 1 HAS A CWIDTH OF 39.
COLUMN 2 HAS A CWIDTH OF 39.
COLUMN 3 HAS A CWIDTH OF 39.
COLUMN 4 HAS A CWIDTH OF 39.

OK, 122 points are missing from the equation (459 - 142 - (5 * 39)) but so far so good. Now I increase the 5 columns with one point and assess the widths again. Logically, that renders:

THE PIVOT TABLE WIDTH = 464.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 40.
COLUMN 1 HAS A CWIDTH OF 40.
COLUMN 2 HAS A CWIDTH OF 40.
COLUMN 3 HAS A CWIDTH OF 40.
COLUMN 4 HAS A CWIDTH OF 40.

Again, 122 points of the pivot table width are unaccounted for. Now I increase the 5 columns with one point and assess the widths again. And now something weird occurs:

THE PIVOT TABLE WIDTH = 474.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 41.
COLUMN 1 HAS A CWIDTH OF 41.
COLUMN 2 HAS A CWIDTH OF 41.
COLUMN 3 HAS A CWIDTH OF 41.
COLUMN 4 HAS A CWIDTH OF 41.

Now if I increase 5 columns with one point, then why doesn't the pivot table width become (464 + (5 * 1)) = 469 points? Where do the 5 extra points (474 - 459) come from? The number of points unaccounted for is even larger for larger increases of the column widths.

I thought adding [60, 60, 60, 61] points to the last 4 columns would render the pivot table width (459 + 241 = 700 points) but the disappointing result is something like 778 points.

And the real question: how am I ever going to arrive at a pivot table width of 700 points if the increase doesn't seem to relate in a linear fashion to the 5 column widths?

Thanks in advance,

Ruben
Reply | Threaded
Open this post in threaded view
|

Re: Scripting: weird behavior when adjusting Pivot Table Column Widths

Jon K Peck
If you are creating these tables with CTABLES, there are likely to be hidden columns, and the row label columns may not be what they appear to be visually.  And empty ones are hidden by default.

You can, however, create a tablelook where you set the data cell and row label widths explicitly, and the tables should honor that.

Note also that there is a preference setting that adjusts widths for labels or for both labels and data.

The SPSSINC MODIFY TABLES extension command can also set label and data widths, but for static control, it is more efficient to use a tableLook


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Ruben van den Berg <[hidden email]>
To:        [hidden email],
Date:        02/25/2013 09:43 AM
Subject:        [SPSSX-L] Scripting: weird behavior when adjusting Pivot Table              Column Widths
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear all,

I have a lot of pivot tables in a viewer document and I'd like all of them
to have equal widths. However, something inexplicable is going on. When I
assess the initial width of one pivot table and it's columns, I get the
following:

THE PIVOT TABLE WIDTH = 459.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 39.
COLUMN 1 HAS A CWIDTH OF 39.
COLUMN 2 HAS A CWIDTH OF 39.
COLUMN 3 HAS A CWIDTH OF 39.
COLUMN 4 HAS A CWIDTH OF 39.

OK, 122 points are missing from the equation (459 - 142 - (5 * 39)) but so
far so good. Now I increase the 5 columns with one point and assess the
widths again. Logically, that renders:

THE PIVOT TABLE WIDTH = 464.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 40.
COLUMN 1 HAS A CWIDTH OF 40.
COLUMN 2 HAS A CWIDTH OF 40.
COLUMN 3 HAS A CWIDTH OF 40.
COLUMN 4 HAS A CWIDTH OF 40.

Again, 122 points of the pivot table width are unaccounted for. Now I
increase the 5 columns with one point and assess the widths again. And now
something weird occurs:

THE PIVOT TABLE WIDTH = *474*.
THE ROW LABEL WIDTH = 142.
COLUMN 0 HAS A CWIDTH OF 41.
COLUMN 1 HAS A CWIDTH OF 41.
COLUMN 2 HAS A CWIDTH OF 41.
COLUMN 3 HAS A CWIDTH OF 41.
COLUMN 4 HAS A CWIDTH OF 41.

Now if I increase 5 columns with one point, then why doesn't the pivot table
width become (464 + (5 * 1)) = 469 points? Where do the 5 extra points (474
- 459) come from? The number of points unaccounted for is even larger for
larger increases of the column widths.

I thought adding [60, 60, 60, 61] points to the last 4 columns would render
the pivot table width (459 + 241 = 700 points) but the disappointing result
is something like 778 points.

And the real question: how am I ever going to arrive at a pivot table width
of 700 points if the increase doesn't seem to relate in a linear fashion to
the 5 column widths?

Thanks in advance,

Ruben



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Scripting-weird-behavior-when-adjusting-Pivot-Table-Column-Widths-tp5718237.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD