Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

show an inline error message if an embedded table does not fit the page (column width is smaller than a character)

as-op780c10f8bf3c
diff --git a/app/models/work_package/pdf_export/export/wp/attributes.rb b/app/models/work_package/pdf_export/export/wp/attributes.rb
index 191c68a7b39..69d65d4bf6c 100644
--- a/app/models/work_package/pdf_export/export/wp/attributes.rb
+++ b/app/models/work_package/pdf_export/export/wp/attributes.rb
@@ -55,6 +55,12 @@ module WorkPackage::PDFExport::Export::Wp::Attributes
write_group_title(group)
related_work_packages = group.query.results.work_packages
write_work_packages_table!(related_work_packages, group.query)
+ rescue Prawn::Errors::CannotFit
+ with_margin(styles.wp_markdown_label_margins) do
+ pdf.formatted_text(
+ [{ text: "[#{I18n.t("export.errors.embedded_table_with_too_many_columns")}]", color: "FF0000", size: 8 }]
+ )
+ end
end
def write_attributes_group(group, work_package)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2b5b2a21672..c3866fbfaba 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2204,6 +2204,8 @@ en:
your_work_packages_export: "Work packages are being exported"
succeeded: "Export completed"
failed: "An error has occurred while trying to export the work packages: %{message}"
+ errors:
+ embedded_table_with_too_many_columns: "This embedded work package table could not fit on the page, please reduce the number of columns."
format:
atom: "Atom"
csv: "CSV"