fix/bug51597

fix bug when document convert from odt to docx and docx to odt and after this document cells width will smaller then before convertation.
This commit is contained in:
Timofey Derevyankin
2025-10-14 12:33:13 +03:00
parent 26b598784e
commit 1d88830b38
2 changed files with 17 additions and 4 deletions

View File

@ -498,11 +498,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
{
convert(dynamic_cast<OOX::Logic::CTbl*>(oox_unknown));
}break;
case OOX::et_w_tr:
case OOX::et_w_tr:
{
convert(dynamic_cast<OOX::Logic::CTr*>(oox_unknown));
}break;
case OOX::et_w_tc:
case OOX::et_w_tc:
{
convert(dynamic_cast<OOX::Logic::CTc*>(oox_unknown));
}break;
@ -4891,9 +4891,20 @@ void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid)
if (oox_table_grid->m_arrGridCol[i] == NULL) continue;
double width = -1;
const double pt_per_cm = 28.3464567;
if (oox_table_grid->m_arrGridCol[i]->m_oW.IsInit())
{
width = oox_table_grid->m_arrGridCol[i]->m_oW->ToPoints();
if( oox_table_grid->m_arrGridCol[i]->m_oW->ToPoints() / pt_per_cm < 7.0 ) // check bug 51597
{
int twips = oox_table_grid->m_arrGridCol[i]->m_oW->ToTwips();
const double points = (twips + 37) / 20.0;
width = points;
}
else
{
width = oox_table_grid->m_arrGridCol[i]->m_oW->ToPoints();
}
}
odt_context->add_table_column(width);

View File

@ -527,8 +527,10 @@ void odf_table_context::change_current_column_width(double width)
else
{
double old_width = column_properties->attlist_.style_column_width_->get_value_unit(length::pt);
if (old_width < width/* && width < impl_->odf_context_->page_layout_context()->current_page_width_*/ && old_width < 9)
if (old_width < width/* && width < impl_->odf_context_->page_layout_context()->current_page_width_*/ && old_width < 5) // check bug 51597
{
column_properties->attlist_.style_column_width_ = length_;
}
}
}