<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Word wrap in dashboards in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/word-wrap-in-dashboards/m-p/91968#M8428</link>
    <description>&lt;P&gt;When I'm displaying a Table-style visualization in a notebook dashboard, is there a setting I can apply to a text column so that it automatically word-wraps text longer than the display width of the column?&lt;BR /&gt;&lt;BR /&gt;For example, in the following dashboard display, I have clicked the pointer symbol in row 2 to make the entire string visible.&amp;nbsp; I want the notebook to do this automatically for all cells, or for all cells in a specific column.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="solution3.png" style="width: 295px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/11541iEF10A91D175A073A/image-size/large?v=v2&amp;amp;px=999" role="button" title="solution3.png" alt="solution3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2024 20:57:36 GMT</pubDate>
    <dc:creator>DavidKxx</dc:creator>
    <dc:date>2024-09-26T20:57:36Z</dc:date>
    <item>
      <title>Word wrap in dashboards</title>
      <link>https://community.databricks.com/t5/get-started-discussions/word-wrap-in-dashboards/m-p/91968#M8428</link>
      <description>&lt;P&gt;When I'm displaying a Table-style visualization in a notebook dashboard, is there a setting I can apply to a text column so that it automatically word-wraps text longer than the display width of the column?&lt;BR /&gt;&lt;BR /&gt;For example, in the following dashboard display, I have clicked the pointer symbol in row 2 to make the entire string visible.&amp;nbsp; I want the notebook to do this automatically for all cells, or for all cells in a specific column.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="solution3.png" style="width: 295px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/11541iEF10A91D175A073A/image-size/large?v=v2&amp;amp;px=999" role="button" title="solution3.png" alt="solution3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 20:57:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/word-wrap-in-dashboards/m-p/91968#M8428</guid>
      <dc:creator>DavidKxx</dc:creator>
      <dc:date>2024-09-26T20:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Word wrap in dashboards</title>
      <link>https://community.databricks.com/t5/get-started-discussions/word-wrap-in-dashboards/m-p/91998#M8429</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/94566"&gt;@DavidKxx&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;That is quite similar question to one about displaying array as bullet list.&amp;nbsp;&lt;BR /&gt;Since you were successful in implementing displayHTML, what do you think about doing similar in this case?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Sample DataFrame with long text
data = [
    (1, 'This is a short text.'),
    (2, 'This is a much longer text that would normally be truncated in a standard table visualization, but we want it to wrap automatically within the cell without needing to expand the cell manually.')
]

df = spark.createDataFrame(data, ['id', 'text'])

# Collect data to the driver
rows = df.collect()

# Start building the HTML string
table_html = '''
&amp;lt;style&amp;gt;
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border: 1px solid black;
    text-align: left;
    padding: 8px;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 200px; /* Adjust the max-width as needed */
}
&amp;lt;/style&amp;gt;
&amp;lt;table&amp;gt;
    &amp;lt;tr&amp;gt;
        &amp;lt;th&amp;gt;id&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;text&amp;lt;/th&amp;gt;
    &amp;lt;/tr&amp;gt;
'''

# Add table rows
for row in rows:
    table_html += '&amp;lt;tr&amp;gt;'
    table_html += f'&amp;lt;td&amp;gt;{row["id"]}&amp;lt;/td&amp;gt;'
    table_html += f'&amp;lt;td&amp;gt;{row["text"]}&amp;lt;/td&amp;gt;'
    table_html += '&amp;lt;/tr&amp;gt;'

table_html += '&amp;lt;/table&amp;gt;'

displayHTML(table_html)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1727420058191.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/11551i93D4808B9178067C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipniziol_0-1727420058191.png" alt="filipniziol_0-1727420058191.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 06:54:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/word-wrap-in-dashboards/m-p/91998#M8429</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2024-09-27T06:54:57Z</dc:date>
    </item>
  </channel>
</rss>

