Commit e6c33419 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - fix users file

parent a639fc9e
......@@ -87,19 +87,19 @@ namespace DocFileFormat
case sprmOldTDefTable:
case sprmTDefTable:
{ //table definition
{
//table definition
SprmTDefTable tDef( iter->Arguments, iter->argumentsSize );
//Workaround for retrieving the indent of the table:
//In some files there is a indent but no sprmTWidthIndent is set.
//For this cases we can calculate the indent of the table by getting the
//first boundary of the TDef and adding the padding of the cells
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
//add the gabHalf
tblIndent += gabHalf;
//If there follows a real sprmTWidthIndent, this value will be overwritten
tblIndent = (std::max)((int)tblIndent,0);
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
}
break;
......
......@@ -865,13 +865,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if (attlists_.rel_size_.style_rel_width_)
{
int type = attlists_.rel_size_.style_rel_width_->get_type();
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
int type = attlists_.rel_size_.style_rel_width_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
}
if (attlists_.rel_size_.style_rel_height_ )
{
int type = attlists_.rel_size_.style_rel_height_->get_type();
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
int type = attlists_.rel_size_.style_rel_height_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
}
}
......@@ -1286,7 +1290,10 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
if (drawing.cx > max_x) drawing.cy = max_x;
}
if (auto_fit_shape)
{
drawing.additional.push_back(_property(L"text-wrap" , 0));
drawing.additional.push_back(_property(L"auto-grow-height", auto_fit_shape));
}
else if (auto_fit_text)
drawing.additional.push_back(_property(L"fit-to-size", auto_fit_text));
......
......@@ -115,13 +115,13 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (style_rel_width_)
{
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
}
else if (style_width_)
{
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
if (w_w > 31680)w_w = 31680;
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
}
else
{
......@@ -137,7 +137,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (table_align_)
{
std::wstring w_val = L"left";
if (table_align_->get_type() == table_align::Margins)
if (table_align_->get_type() == table_align::Margins || table_align_->get_type() == table_align::Left)
{
if (common_horizontal_margin_attlist_.fo_margin_left_ && common_horizontal_margin_attlist_.fo_margin_right_)
{
......@@ -147,19 +147,15 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (w_val != L"center" && common_horizontal_margin_attlist_.fo_margin_left_ )
{
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20<< "\" w:type=\"dxa\" />";
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
}
}
else
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
}
if (table_align_ && table_align_->get_type() == table_align::Center)
{
// TODO ()
}
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
if (common_background_color_attlist_.fo_background_color_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment