diff --git a/include/report.cpp b/include/report.cpp index c1a5d41cd..5887e57fc 100755 --- a/include/report.cpp +++ b/include/report.cpp @@ -374,22 +374,19 @@ void advanced_draw_paragraph(TWindow& win, TString& para, const RCT& rct, char halign, char valign) { const bool acapo = para.find('\n') >= 0; - const bool parag = para.find(char(0xB6)) >= 0; int leading, ascent, descent; xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent); const int ky = leading + ascent + descent; const int rct_height = rct.bottom - rct.top; - int rows = rct_height / ky; + int rows = (rct_height+ky/2) / ky; - if (acapo || parag || rows > 1) // Devo scrivere piu' righe? + if (acapo || rows > 1) // Devo scrivere piu' righe? { const int kx = xvt_dwin_get_text_width(win.win(), "ABCDEFGH", 8) / 8; const unsigned columns = (rct.right - rct.left) / kx; - if (parag) - para.replace(char('0xB6'), '\n'); TParagraph_string str(para, columns); if (str.items() < rows) rows = str.items(); @@ -1294,6 +1291,13 @@ const TString& TReport_field::formatted_text() const tmp << _picture << ' ' << _var.as_string(); return tmp; } + if (dynamic_height() && _var.as_string().find(char(0xB6)) >= 0) + { + TString& tmp = get_tmp_string(); + tmp = _var.as_string(); + tmp.replace(char(0xB6), '\n'); + return tmp; + } return _var.as_string(); } return EMPTY_STRING; diff --git a/include/reprint.cpp b/include/reprint.cpp index 6f31e5fbb..2eaf02554 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -905,6 +905,8 @@ bool TBook::print_page(TWindow& win, size_t page) ifs.getline(buffer, str.size()); if (str == "") break; + if (stringona.not_empty()) + stringona << '\n'; stringona << str; } advanced_draw_paragraph(win, stringona, rct, _horizontal_alignment, _vertical_alignment);