Skip to content

Commit f617c8e

Browse files
Merge pull request frappe#20152 from surajshetty3416/print-grid-overflow-issue
2 parents 34beb65 + 305628b commit f617c8e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

frappe/public/js/frappe/views/reports/print_grid.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ <h2>{{ __(title) }}</h2>
3636
</td>
3737
{% for col in columns %}
3838
{% if col.name && col._id !== "_check" %}
39-
40-
{% var value = col.fieldname ? row[col.fieldname] : row[col.id]; %}
41-
42-
<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %}>
39+
{% var value = col.fieldname ? row[col.fieldname] : row[col.id] %}
40+
{% var longest_word = cstr(value).split(' ').reduce((longest, word) => word.length > longest.length ? word : longest, ''); %}
41+
<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %} {% if longest_word.length > 45 %} class="overflow-wrap-anywhere" {% endif %}>
4342
<span {% if col._index == 0 %} style="padding-left: {%= cint(row.indent) * 2 %}em" {% endif %}>
4443
{% format_data = row.is_total_row && ["Currency", "Float"].includes(col.fieldtype) ? data[0] : row %}
4544
{% if (row.is_total_row && col._index == 0) { %}

frappe/public/scss/print.bundle.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@
3434
img {
3535
margin: auto;
3636
}
37+
}
38+
39+
.overflow-wrap-anywhere {
40+
* {
41+
overflow-wrap: anywhere;
42+
}
3743
}

0 commit comments

Comments
 (0)