@@ -380,7 +380,7 module Redmine | |||||
380 | col_width |
|
380 | col_width | |
381 | end |
|
381 | end | |
382 |
|
382 | |||
383 |
def render_table_header(pdf, query, col_width, row_height, |
|
383 | def render_table_header(pdf, query, col_width, row_height, table_width) | |
384 | # headers |
|
384 | # headers | |
385 | pdf.SetFontStyle('B',8) |
|
385 | pdf.SetFontStyle('B',8) | |
386 | pdf.SetFillColor(230, 230, 230) |
|
386 | pdf.SetFillColor(230, 230, 230) | |
@@ -389,13 +389,12 module Redmine | |||||
389 | base_x = pdf.GetX |
|
389 | base_x = pdf.GetX | |
390 | base_y = pdf.GetY |
|
390 | base_y = pdf.GetY | |
391 | max_height = issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true) |
|
391 | max_height = issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true) | |
392 |
pdf.Rect(base_x, base_y, table_width |
|
392 | pdf.Rect(base_x, base_y, table_width, max_height, 'FD'); | |
393 | pdf.SetXY(base_x, base_y); |
|
393 | pdf.SetXY(base_x, base_y); | |
394 |
|
394 | |||
395 | # write the cells on page |
|
395 | # write the cells on page | |
396 | pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1) |
|
|||
397 | issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true) |
|
396 | issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true) | |
398 |
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, |
|
397 | issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width) | |
399 | pdf.SetY(base_y + max_height); |
|
398 | pdf.SetY(base_y + max_height); | |
400 |
|
399 | |||
401 | # rows |
|
400 | # rows | |
@@ -417,22 +416,22 module Redmine | |||||
417 | # Landscape A4 = 210 x 297 mm |
|
416 | # Landscape A4 = 210 x 297 mm | |
418 | page_height = 210 |
|
417 | page_height = 210 | |
419 | page_width = 297 |
|
418 | page_width = 297 | |
|
419 | left_margin = 10 | |||
420 | right_margin = 10 |
|
420 | right_margin = 10 | |
421 | bottom_margin = 20 |
|
421 | bottom_margin = 20 | |
422 | col_id_width = 10 |
|
|||
423 | row_height = 4 |
|
422 | row_height = 4 | |
424 |
|
423 | |||
425 | # column widths |
|
424 | # column widths | |
426 |
table_width = page_width - right_margin - |
|
425 | table_width = page_width - right_margin - left_margin | |
427 | col_width = [] |
|
426 | col_width = [] | |
428 | unless query.inline_columns.empty? |
|
427 | unless query.inline_columns.empty? | |
429 |
col_width = calc_col_width(issues, query, table_width |
|
428 | col_width = calc_col_width(issues, query, table_width, pdf) | |
430 | table_width = col_width.inject(0) {|s,v| s += v} |
|
429 | table_width = col_width.inject(0) {|s,v| s += v} | |
431 | end |
|
430 | end | |
432 |
|
431 | |||
433 |
|
|
432 | # use full width if the description is displayed | |
434 | if table_width > 0 && query.has_column?(:description) |
|
433 | if table_width > 0 && query.has_column?(:description) | |
435 |
col_width = col_width.map {|w| w |
|
434 | col_width = col_width.map {|w| w * (page_width - right_margin - left_margin) / table_width} | |
436 | table_width = col_width.inject(0) {|s,v| s += v} |
|
435 | table_width = col_width.inject(0) {|s,v| s += v} | |
437 | end |
|
436 | end | |
438 |
|
437 | |||
@@ -440,7 +439,7 module Redmine | |||||
440 | pdf.SetFontStyle('B',11) |
|
439 | pdf.SetFontStyle('B',11) | |
441 | pdf.RDMCell(190,10, title) |
|
440 | pdf.RDMCell(190,10, title) | |
442 | pdf.Ln |
|
441 | pdf.Ln | |
443 |
render_table_header(pdf, query, col_width, row_height, |
|
442 | render_table_header(pdf, query, col_width, row_height, table_width) | |
444 | previous_group = false |
|
443 | previous_group = false | |
445 | issue_list(issues) do |issue, level| |
|
444 | issue_list(issues) do |issue, level| | |
446 | if query.grouped? && |
|
445 | if query.grouped? && | |
@@ -449,7 +448,7 module Redmine | |||||
449 | group_label = group.blank? ? 'None' : group.to_s.dup |
|
448 | group_label = group.blank? ? 'None' : group.to_s.dup | |
450 | group_label << " (#{query.issue_count_by_group[group]})" |
|
449 | group_label << " (#{query.issue_count_by_group[group]})" | |
451 | pdf.Bookmark group_label, 0, -1 |
|
450 | pdf.Bookmark group_label, 0, -1 | |
452 |
pdf.RDMCell(table_width |
|
451 | pdf.RDMCell(table_width, row_height * 2, group_label, 1, 1, 'L') | |
453 | pdf.SetFontStyle('',8) |
|
452 | pdf.SetFontStyle('',8) | |
454 | previous_group = group |
|
453 | previous_group = group | |
455 | end |
|
454 | end | |
@@ -468,15 +467,14 module Redmine | |||||
468 | space_left = page_height - base_y - bottom_margin |
|
467 | space_left = page_height - base_y - bottom_margin | |
469 | if max_height > space_left |
|
468 | if max_height > space_left | |
470 | pdf.AddPage("L") |
|
469 | pdf.AddPage("L") | |
471 |
render_table_header(pdf, query, col_width, row_height, |
|
470 | render_table_header(pdf, query, col_width, row_height, table_width) | |
472 | base_x = pdf.GetX |
|
471 | base_x = pdf.GetX | |
473 | base_y = pdf.GetY |
|
472 | base_y = pdf.GetY | |
474 | end |
|
473 | end | |
475 |
|
474 | |||
476 | # write the cells on page |
|
475 | # write the cells on page | |
477 | pdf.RDMCell(col_id_width, row_height, issue.id.to_s, "T", 0, 'C', 1) |
|
|||
478 | issues_to_pdf_write_cells(pdf, col_values, col_width, row_height) |
|
476 | issues_to_pdf_write_cells(pdf, col_values, col_width, row_height) | |
479 |
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, |
|
477 | issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width) | |
480 | pdf.SetY(base_y + max_height); |
|
478 | pdf.SetY(base_y + max_height); | |
481 |
|
479 | |||
482 | if query.has_column?(:description) && issue.description? |
|
480 | if query.has_column?(:description) && issue.description? | |
@@ -513,9 +511,8 module Redmine | |||||
513 | end |
|
511 | end | |
514 |
|
512 | |||
515 | # Draw lines to close the row (MultiCell border drawing in not uniform) |
|
513 | # Draw lines to close the row (MultiCell border drawing in not uniform) | |
516 | def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, |
|
514 | def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, col_widths) | |
517 | id_width, col_widths) |
|
515 | col_x = top_x | |
518 | col_x = top_x + id_width |
|
|||
519 | pdf.Line(col_x, top_y, col_x, lower_y) # id right border |
|
516 | pdf.Line(col_x, top_y, col_x, lower_y) # id right border | |
520 | col_widths.each do |width| |
|
517 | col_widths.each do |width| | |
521 | col_x += width |
|
518 | col_x += width |
General Comments 0
You need to be logged in to leave comments.
Login now