Skip to content

Commit

Permalink
Merge pull request frappe#20152 from surajshetty3416/print-grid-overf…
Browse files Browse the repository at this point in the history
…low-issue
  • Loading branch information
surajshetty3416 authored Feb 24, 2023
2 parents 34beb65 + 305628b commit f617c8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frappe/public/js/frappe/views/reports/print_grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ <h2>{{ __(title) }}</h2>
</td>
{% for col in columns %}
{% if col.name && col._id !== "_check" %}

{% var value = col.fieldname ? row[col.fieldname] : row[col.id]; %}

<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %}>
{% var value = col.fieldname ? row[col.fieldname] : row[col.id] %}
{% var longest_word = cstr(value).split(' ').reduce((longest, word) => word.length > longest.length ? word : longest, ''); %}
<td {% if row.bold == 1 %} style="font-weight: bold" {% endif %} {% if longest_word.length > 45 %} class="overflow-wrap-anywhere" {% endif %}>
<span {% if col._index == 0 %} style="padding-left: {%= cint(row.indent) * 2 %}em" {% endif %}>
{% format_data = row.is_total_row && ["Currency", "Float"].includes(col.fieldtype) ? data[0] : row %}
{% if (row.is_total_row && col._index == 0) { %}
Expand Down
6 changes: 6 additions & 0 deletions frappe/public/scss/print.bundle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@
img {
margin: auto;
}
}

.overflow-wrap-anywhere {
* {
overflow-wrap: anywhere;
}
}

0 comments on commit f617c8e

Please sign in to comment.