Creating a table in a blank page
Asked by Jim Chester:

When I create a table inside of a blank page the fields inside of the table are "Auto Expanding" as I type. Is there a way to size them and make it static instead of having it real small and expand as the I type in that field.


Answers:
author: Elisa [Atlassian]
body: Hi Jim,

Unfortunately tables are only sized to the content and it's not possible to control columns' width.

Perhaps, you can take a look at '[Advanced Tables for Confluence](https://marketplace.atlassian.com/plugins/org.swift.confluence.table)' (paid) add-on by BobSwift to see if they have an option that will allow you to do so. :smile:

Cheers!

comments: author: Bob Swift (personal)
body: Yes, see <https://bobswift.atlassian.net/wiki/display/TBL/Controlling+the+Width+of+Table+Columns>


author: Davin Studer
body: I have created a user macro that does this.

```
## Developed by: Davin Studer## Date created: 04/30/2014?## @param AutoNumber:title=Autonumber Rows|type=boolean|desc=This will autonumber the rows in the table that are not heading rows.|default=false## @param HeadingReset:title=Reset Count|type=boolean|desc=This will reset the count each time a heading row is encountered. (only applicable if Autonumber Rows is checked)|default=false## @param Zebra:title=Zebra Table|type=boolean|desc=This will alternate the color of the table's rows.|default=false## @param NoScroll:title=No Table Scroll|type=boolean|desc=This will turn off the scroll bat that is at the bottom of the table in favor of one always at the bottom of the page. This is useful for tables that are wider than the page.|default=false## @param Width:title=Table Width|type=string|required=false|desc=This will set the width of the table. Acceptable values are in % or px.## @param Class:title=CSS Class|type=string|required=false|desc=This will assign a css class to the table.## @param ColWidth:title=Column Widths|type=string|required=false|desc=Use a comma separated list of column widths for the table. Acceptable values are in % or px.?#set( $id = $action.dateFormatter.calendar.timeInMillis )?&lt;div id="table$id"&gt;$body&lt;/div&gt;?&lt;style type="text/css"&gt;#if ( $paramZebra == true )#table$id tr:nth-child(odd) {background-color: #E0F0FF;}#table$id tr:nth-child(even) {background-color: #FFFFFF;}#end#if ( $paramNoScroll == true )#table$id .table-wrap {overflow-x: visible;}#end&lt;/style&gt;&lt;script type="text/javascript"&gt;AJS.toInit(function(){    AJS.$('#table$id table').each(function(){        ################        ## Autonumber ##        ################        #if ( $paramAutoNumber == true )        var number = true;        #else        var number = false;        #end                #if ( $paramHeadingReset == true )        var reset = true;        #else        var reset = false;        #end                ################        ## Width      ##        ################        #if ( $paramWidth &amp;&amp; $paramWidth != "" )        var tblWidth = '$paramWidth';        #else        var tblWidth = '';        #end                ################        ## Class      ##        ################        #if ( $paramClass &amp;&amp; $paramClass != "" )        var cssClass = '$paramClass';        #else        var cssClass = '';        #end        ################        ## Col Width  ##        ################        #if ( $paramColWidth &amp;&amp; $paramColWidth != "" )        var colWidth = '$paramColWidth';        #else        var colWidth = '';        #end        if(number) {            var count = 1;                        AJS.$('tr', this).each(function(){                if(AJS.$('th',this).length != 0) {                    AJS.$(this).prepend('&lt;th class="confluenceTh"&gt; &lt;/th&gt;');                    if(reset) {                        count = 1;                    }                } else {                    AJS.$(this).prepend('&lt;td class="confluenceTd"&gt;' + count + '&lt;/td&gt;');                    count++;                }            });        }                if(tblWidth != "") {            AJS.$(this).css('width', tblWidth);        }                if(cssClass != "") {            AJS.$(this).addClass(cssClass);        }                if(colWidth != "") {            var arrColWidth = colWidth.split(',');            var firstRow = AJS.$('tr:first-child', this);            var tdorth = AJS.$('td', firstRow).length == 0 ? 'th' : 'td';                        AJS.$(tdorth, firstRow).each(function(index){                if(index + 1 &lt;= arrColWidth.length &amp;&amp; arrColWidth[index].trim().search(/^([0-9]+)(%|px)$/) != -1) {                    AJS.$(this).css('width', arrColWidth[index].trim());                }            });        }    });});&lt;/script&gt;
```

comments: author: Davin Studer
body: Oh shoot! I just realized it was tagged as confluence-cloud. If you are using OnDemand then user macros are not an option. Sorry.


Tags: cloud

confluence-cloud