diff --git a/include/sheet.cpp b/include/sheet.cpp index c839b9677..c0c560647 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -122,6 +122,7 @@ TSheet_control::TSheet_control( TToken_string new_header(header.size()); int f_width = NUMBER_WIDTH; // Stima larghezza colonne fisse int max_width = f_width; // Stima larghezza della colonna piu' grande + int tot_width = f_width; int lines_in_header = 1; const char * h; @@ -188,6 +189,10 @@ TSheet_control::TSheet_control( max_width = v; new_header.add(testa); + + tot_width += v_width[i]; + if (tot_width > 2048) // Taglio corto con gli sheet enormi > 16000 pixel + break; } // Calcola rettangolo massimo per lo sheet @@ -261,8 +266,9 @@ TSheet_control::TSheet_control( } } - RCT rd; xi_get_def_rect(listdef, (XinRect *) &rd); - if ((rd.right - rd.left) > (rct.right - rct.left)) + // Attenzione: negli sheet molto grandi succede che rd.right < 0 + RCT rd; xi_get_def_rect(listdef, (XinRect *) &rd); + if (rd.right < 0 || (rd.right - rd.left) > (rct.right - rct.left)) l->width = rct.right - rct.left; _obj = xi_create(itf, listdef); // Create the whole thing!