# Accessing Power Table Attributes

**URL:** <https://forum.inductiveautomation.com/t/accessing-power-table-attributes/21720>\
**Category:** Ignition\
**Created:** [January 7, 2019, 7:44pm UTC](https://forum.inductiveautomation.com/t/accessing-power-table-attributes/21720 "2019-01-07T19:44:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 7, 2019, 7:44pm UTC](https://forum.inductiveautomation.com/t/accessing-power-table-attributes/21720/1 "2019-01-07T19:44:45Z")

</div>

I’m looking at retrieving the inner viewport horizontal extents of a power table only when the horizontal scrollbar component is visible. Anyone got anything on this?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 8, 2019, 2:41pm UTC](https://forum.inductiveautomation.com/t/accessing-power-table-attributes/21720/2 "2019-01-08T14:41:59Z")

</div>

I was able to figure this out. I wanted to print out a window and make a table print entirely when it has scrollbars. I was able to get the table’s actual width and compare it to the width of the table’s viewport, which tells me if it has a scroll bar or not. If it does, then I transform the table to it’s actual size for printing, then return it to normal size afterwards. It worked like a charm.

```auto
windowName = system.nav.getCurrentWindow()
try:
    rc = system.gui.getWindow(windowName).getRootContainer()
    powerTable = event.source.parent.getComponent('Power Table')
    t = powerTable.getTable()
    actualWidth = t.getWidth()
    visibleWidth = t.getVisibleRect().width
    if actualWidth > visibleWidth:
    	system.gui.transform(powerTable, newWidth = actualWidth)
    
    job = system.print.createPrintJob(rc)
    job.setMargins(0.5)
    job.showPageFormat = 1
    job.orientation = 1
    job.print()
    
    def	reset():
    	system.gui.transform(powerTable, newWidth = visibleWidth)
    system.util.invokeLater(reset)
    
except:
    # window not opened
    pass

```
