PDF: wrap title fields properly (#8295).
Contributed Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5651 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
973f3eb50e
commit
919bf61cae
|
@ -228,11 +228,19 @@ module Redmine
|
||||||
# headers
|
# headers
|
||||||
pdf.SetFontStyle('B',8)
|
pdf.SetFontStyle('B',8)
|
||||||
pdf.SetFillColor(230, 230, 230)
|
pdf.SetFillColor(230, 230, 230)
|
||||||
pdf.RDMCell(col_id_width, row_height, "#", 1, 0, 'C', 1)
|
|
||||||
query.columns.each_with_index do |column, i|
|
# render it background to find the max height used
|
||||||
pdf.RDMCell(col_width[i], row_height, column.caption, 1, 0, 'L', 1)
|
base_x = pdf.GetX
|
||||||
end
|
base_y = pdf.GetY
|
||||||
pdf.Ln
|
max_height = issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true)
|
||||||
|
pdf.Rect(base_x, base_y, table_width, max_height, 'FD');
|
||||||
|
pdf.SetXY(base_x, base_y);
|
||||||
|
|
||||||
|
# write the cells on page
|
||||||
|
pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1)
|
||||||
|
issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true)
|
||||||
|
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
|
||||||
|
pdf.SetY(base_y + max_height);
|
||||||
|
|
||||||
# rows
|
# rows
|
||||||
pdf.SetFontStyle('',8)
|
pdf.SetFontStyle('',8)
|
||||||
|
@ -296,12 +304,16 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders MultiCells and returns the maximum height used
|
# Renders MultiCells and returns the maximum height used
|
||||||
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height)
|
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
|
||||||
base_y = pdf.GetY
|
base_y = pdf.GetY
|
||||||
max_height = row_height
|
max_height = row_height
|
||||||
col_values.each_with_index do |column, i|
|
col_values.each_with_index do |column, i|
|
||||||
col_x = pdf.GetX
|
col_x = pdf.GetX
|
||||||
pdf.RDMMultiCell(col_widths[i], row_height, col_values[i], "T", 'L', 1)
|
if head == true
|
||||||
|
pdf.RDMMultiCell(col_widths[i], row_height, column.caption, "T", 'L', 1)
|
||||||
|
else
|
||||||
|
pdf.RDMMultiCell(col_widths[i], row_height, column, "T", 'L', 1)
|
||||||
|
end
|
||||||
max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height
|
max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height
|
||||||
pdf.SetXY(col_x + col_widths[i], base_y);
|
pdf.SetXY(col_x + col_widths[i], base_y);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue