Table transformer stylesheet for plain text outputs
Asked by Green_ Desmond:

I use a couple of table transformer macros within a table, each producing plain text outputs, as such:

![Transformer text 2.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/308918iB85910ABC954C617/image-size/large?v=v2&px=999 "Transformer text 2.JPG")

The outputs look like this:

![Transformer text 1.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/308917i3C333B850F4724B8/image-size/large?v=v2&px=999 "Transformer text 1.JPG")

The rows are padded out with extra spacing, which I do not want but am not able to directly avoid. I want the size of the rows to reduce to minimum height.

I note there is now a 'Stylesheet' panel within the table transformer macro. How do I use this to reduce the row sizes to the minimum?

Do I need to put the containing table into another table transformer macro? Even so, what do I need to enter into the 'Stylesheet' section of the table transformer macro(s) to have this display how I want? I'm not sure of the syntax of the 'Stylesheet' section or the specifics to do what I need?


Answers:
author: Stiltsoft support
body: Hi [@Green_ Desmond](/t5/user/viewprofilepage/user-id/5367657) ,

You may put the following code in the Stylesheet section of the Table Transformer macro:

.table-wrap {  
margin-top: 0;  
margin-bottom: 0;  
}

comments: author: Green_ Desmond
body: It doesn't seem to work. If it helps, here is the source HTML, where I have a table, with 2 rows and a table transformer in each row, both with the stylesheet attribute you mentioned. I don't have much control over the HTML, since it is generated by Confluence.

```
<ac:layout-section ac:type="single">
<ac:layout-cell>
<table data-mce-resize="false">
<colgroup class=""> <col class=""/> <col class=""/> </colgroup>
<tbody class="">
<tr class="">
<td class="highlight-#deebff" data-highlight-colour="#deebff" style="text-align: center;">
<h4 title="">Rating</h4>
</td>
<td class="highlight-#deebff" data-highlight-colour="#deebff" style="text-align: center;">
<h4 title="">%</h4>
</td>
</tr>
<tr class="">
<td style="text-align: center;">A</td>
<td style="text-align: center;">
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="3fccda30-3584-4a34-9ac9-4127cac5f4ce" ac:name="table-joiner" ac:schema-version="1">
<ac:parameter ac:name="dateFormat">dd/mm/yyyy</ac:parameter>
<ac:parameter ac:name="export-word">false</ac:parameter>
<ac:parameter ac:name="customNoTableMsgText">No data!</ac:parameter>
<ac:parameter ac:name="export-csv">false</ac:parameter>
<ac:parameter ac:name="join-column">Date</ac:parameter>
<ac:parameter ac:name="separator">.</ac:parameter>
<ac:parameter ac:name="version">3</ac:parameter>
<ac:parameter ac:name="export-print">false</ac:parameter>
<ac:parameter ac:name="sql">SELECT CONCAT(? ROUND(AVG(CASE WHEN T1.'Current' = "A" THEN 100.0 ELSE 0 END), 0),? "% (",? SUM(CASE WHEN T1.'Current' = "A" THEN 1 ELSE 0 END),? "/",? COUNT('Date'),? ")") AS 'Counted Value'?FROM T1</ac:parameter>
<ac:parameter ac:name="thousand-separator"/>
<ac:parameter ac:name="isFirstTimeEnter">true</ac:parameter>
<ac:parameter ac:name="transposeResult">false</ac:parameter>
<ac:parameter ac:name="decimals">0</ac:parameter>
<ac:parameter ac:name="show-source">false</ac:parameter>
<ac:parameter ac:name="plainText">true</ac:parameter>
<ac:parameter ac:name="customNoResultsMsg">true</ac:parameter>
<ac:parameter ac:name="customNoTableMsg">true</ac:parameter>
<ac:parameter ac:name="styles">.table-wrap ??margin-top: 0;?margin-bottom: 0;?}</ac:parameter>
<ac:parameter ac:name="id">1709117825772_-348408325</ac:parameter>
<ac:parameter ac:name="transpose">false</ac:parameter>
<ac:parameter ac:name="worklog">365|5|24|y w d h m|y w d h m</ac:parameter>
<ac:parameter ac:name="customNoResultsMsgText">No data!</ac:parameter>
<ac:parameter ac:name="export-pdf">false</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="d496567e-f19f-4c89-b9a6-449cc5531c44" ac:name="table-excerpt-include" ac:schema-version="1">
<ac:parameter ac:name="isFirstTimeEnter">true</ac:parameter>
<ac:parameter ac:name="copytable">true</ac:parameter>
<ac:parameter ac:name="v">2</ac:parameter>
<ac:parameter ac:name="name">SonarQube ratings with targets</ac:parameter>
<ac:parameter ac:name="merge-tables">true</ac:parameter>
<ac:parameter ac:name="page">
<ac:link>
<ri:page ri:content-title="Code Quality - 2024 data"/>
</ac:link>
</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</div>
</td>
</tr>
<tr class="">
<td style="text-align: center;">B</td>
<td style="text-align: center;">
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="a649a26a-00a0-4db5-86ee-f362cd80ee8c" ac:name="table-joiner" ac:schema-version="1">
<ac:parameter ac:name="dateFormat">dd/mm/yyyy</ac:parameter>
<ac:parameter ac:name="export-word">false</ac:parameter>
<ac:parameter ac:name="customNoTableMsgText">No data!</ac:parameter>
<ac:parameter ac:name="export-csv">false</ac:parameter>
<ac:parameter ac:name="join-column">Date</ac:parameter>
<ac:parameter ac:name="separator">.</ac:parameter>
<ac:parameter ac:name="version">3</ac:parameter>
<ac:parameter ac:name="export-print">false</ac:parameter>
<ac:parameter ac:name="sql">SELECT CONCAT(? ROUND(AVG(CASE WHEN T1.'Current' = "B" THEN 100.0 ELSE 0 END),0),? "% (",? SUM(CASE WHEN T1.'Current' = "B" THEN 1 ELSE 0 END),? "/",? COUNT('Date'),? ")") AS 'Counted Value'?FROM T1</ac:parameter>
<ac:parameter ac:name="thousand-separator"/>
<ac:parameter ac:name="isFirstTimeEnter">true</ac:parameter>
<ac:parameter ac:name="transposeResult">false</ac:parameter>
<ac:parameter ac:name="decimals">0</ac:parameter>
<ac:parameter ac:name="show-source">false</ac:parameter>
<ac:parameter ac:name="plainText">true</ac:parameter>
<ac:parameter ac:name="customNoResultsMsg">true</ac:parameter>
<ac:parameter ac:name="customNoTableMsg">true</ac:parameter>
<ac:parameter ac:name="styles">.table-wrap ??margin-top: 0;?margin-bottom: 0;?}</ac:parameter>
<ac:parameter ac:name="id">1709117825774_956689263</ac:parameter>
<ac:parameter ac:name="transpose">false</ac:parameter>
<ac:parameter ac:name="worklog">365|5|24|y w d h m|y w d h m</ac:parameter>
<ac:parameter ac:name="customNoResultsMsgText">No data!</ac:parameter>
<ac:parameter ac:name="export-pdf">false</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="06692cb5-0dc8-4806-af5b-004b431f9050" ac:name="table-excerpt-include" ac:schema-version="1">
<ac:parameter ac:name="isFirstTimeEnter">true</ac:parameter>
<ac:parameter ac:name="copytable">true</ac:parameter>
<ac:parameter ac:name="v">2</ac:parameter>
<ac:parameter ac:name="name">SonarQube ratings with targets</ac:parameter>
<ac:parameter ac:name="merge-tables">true</ac:parameter>
<ac:parameter ac:name="page">
<ac:link>
<ri:page ri:content-title="Code Quality - 2024 data"/>
</ac:link>
</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</div>
</td>
</tr>
</tbody>
</table>
</ac:layout-cell>
</ac:layout-section>
```

It still looks like this, with extra spacing underneath the plain text outputs from the table transformers (the data in the % heading column).

![Table transformer text output 1.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/309172iA7E68428204B8A38/image-size/large?v=v2&px=999 "Table transformer text output 1.JPG")


author: Stiltsoft support
body: Hi [@Green_ Desmond](/t5/user/viewprofilepage/user-id/5367657) ,

We don't see this spacing from your storage in our Confluence. Maybe the version of Confluence may differ, and we also can't see the contents of your Table Excerpt macro.

But as the first step, leave the Stylesheet field blank and change the Options -\> Source data as "Hide all content" in your Table Transformer macros. Publish the page and check how it looks for you.

Then if the plain text from the Table Transformer goes lower than the text in the 'Rating' column, you may play with the previous style:

.table-wrap {  
margin-top: 0;  
margin-bottom: -10px;  
}  

or  

.table-wrap {  
margin-top: 0;  
margin-bottom: 0;  
}


author: Green_ Desmond
body: Yes, selecting the "Hide all content" had the effect of reducing the row height, which I didn't expect at all!


author: Stiltsoft support
body: And what is inside your Table Excerpt table?


author: Green_ Desmond
body: The Table Excerpt Include macros look like this. I've tried 'Show as a report table' on and off.

![Table transformer text output 2.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/309242i079AB089471512FB/image-size/large?v=v2&px=999 "Table transformer text output 2.JPG")


author: Stiltsoft support
body: The "Show as a report table" option is used when you collect several tables with the same headers.

When the option is checked, the tables are merged together and they are shown as a one big table. If the option is unchecked, the tables are shown as separate tables one under another.

So, if you collect (reuse) just one table (and from your screenshot I guess it is so), you don't need this option.

And as I see, this table is just an ordinary manually created table? It is just wrapped into your Table Excerpt macro without any additional symbols or smth?

I mean that on your screenshots of the published table we can see smth like point under the lines with per cents. So, maybe smth extra just comes through the Table Excerpt/Table Excerpt Include macros and we just hide it using the "Hide all content" option.


author: Green_ Desmond
body: No, there isn't anything at the bottom of the source data

Here's the end of the table which is included as a table excerpt. There are not any extra spaces, line breaks, etc. Is there any other way you want me to verify this?

......

\<tr\>  
\<td\>03/01/2024\</td\>  
\<td\>Cloud\</td\>  
\<td\>Releasability\</td\>  
\<td style="text-align: center;"\>A\</td\>  
\</tr\>  
\<tr\>  
\<td\>03/01/2024\</td\>  
\<td\>Cloud\</td\>  
\<td\>Reliability\</td\>  
\<td style="text-align: center;"\>A\</td\>  
\</tr\>  
\<tr\>  
\<td\>03/01/2024\</td\>  
\<td\>Cloud\</td\>  
\<td\>Security Vulnerabilities\</td\>  
\<td style="text-align: center;"\>A\</td\>  
\</tr\>  
\<tr\>  
\<td\>03/01/2024\</td\>  
\<td\>Cloud\</td\>  
\<td\>Security Review\</td\>  
\<td style="text-align: center;"\>A\</td\>  
\</tr\>  
\<tr\>  
\<td\>03/01/2024\</td\>  
\<td\>Cloud\</td\>  
\<td\>Maintainability\</td\>  
\<td style="text-align: center;"\>A\</td\>  
\</tr\>  
\</tbody\>  
\</table\>  
\</div\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\</ac:layout-cell\>  
\</ac:layout-section\>


author: Stiltsoft support
body: No, maybe has smth to do with the version of Confluence or smth. Glad that we've found a solution!


Tags: confluence-data-center

data-center

filter

table

table-filter

table-filter-and-charts

table-filter-charts-spreadsheets

table-transformer