diff --git a/frappe/public/js/frappe/views/reports/print_grid.html b/frappe/public/js/frappe/views/reports/print_grid.html
index 6f693bc93214..7af27145a603 100644
--- a/frappe/public/js/frappe/views/reports/print_grid.html
+++ b/frappe/public/js/frappe/views/reports/print_grid.html
@@ -36,10 +36,9 @@
{{ __(title) }}
{% for col in columns %}
{% if col.name && col._id !== "_check" %}
-
- {% var value = col.fieldname ? row[col.fieldname] : row[col.id]; %}
-
-
+ {% 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, ''); %}
+ | 45 %} class="overflow-wrap-anywhere" {% endif %}>
{% format_data = row.is_total_row && ["Currency", "Float"].includes(col.fieldtype) ? data[0] : row %}
{% if (row.is_total_row && col._index == 0) { %}
diff --git a/frappe/public/scss/print.bundle.scss b/frappe/public/scss/print.bundle.scss
index 3e8baddcb651..d01814575553 100644
--- a/frappe/public/scss/print.bundle.scss
+++ b/frappe/public/scss/print.bundle.scss
@@ -34,4 +34,10 @@
img {
margin: auto;
}
+}
+
+.overflow-wrap-anywhere {
+ * {
+ overflow-wrap: anywhere;
+ }
}
\ No newline at end of file
|