From 0eadce28dabea762bd6fd828a7b77fbbf6fc5bc0 Mon Sep 17 00:00:00 2001 From: Elena Subbotina Date: Thu, 31 Jul 2025 15:51:45 +0300 Subject: [PATCH] fix bug #74757 --- .../Reader/Converter/pptx_table_context.cpp | 10 +++++- OdfFile/Reader/Format/table_pptx.cpp | 32 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/OdfFile/Reader/Converter/pptx_table_context.cpp b/OdfFile/Reader/Converter/pptx_table_context.cpp index 3ba4e2fe4b..0ca977d2d2 100644 --- a/OdfFile/Reader/Converter/pptx_table_context.cpp +++ b/OdfFile/Reader/Converter/pptx_table_context.cpp @@ -438,6 +438,10 @@ void oox_serialize_tcPr(std::wostream & strm, std::vectorcommon_padding_attlist_.fo_padding_left_->get_value_unit(odf_types::length::emu); CP_XML_ATTR(L"marL", (long)padding); } + //else + //{ + // CP_XML_ATTR(L"marL", 3600); + //} if (style_cell_attlist.common_padding_attlist_.fo_padding_right_) { @@ -449,7 +453,11 @@ void oox_serialize_tcPr(std::wostream & strm, std::vectorcommon_padding_attlist_.fo_padding_right_->get_value_unit(odf_types::length::emu); CP_XML_ATTR(L"marR", (long)padding); } - } + //else + //{ + // CP_XML_ATTR(L"marR", 3600); + //} + } //vert // //style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes diff --git a/OdfFile/Reader/Format/table_pptx.cpp b/OdfFile/Reader/Format/table_pptx.cpp index 25c1e6bb4b..7369d10009 100644 --- a/OdfFile/Reader/Format/table_pptx.cpp +++ b/OdfFile/Reader/Format/table_pptx.cpp @@ -37,6 +37,8 @@ #include "serialize_elements.h" #include "odfcontext.h" #include "odf_document.h" +#include "odf_document_impl.h" +#include "office_document.h" #include "style_table_properties.h" #include "style_graphic_properties.h" @@ -391,8 +393,36 @@ void table_table_cell::pptx_convert(oox::pptx_conversion_context & Context) std::wstring style_name; style_instance *style_inst = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::TableCell); - if (style_inst) style_instances.push_back(style_inst); + if (!style_inst) + { + default_style* def_style = new default_style(); + + office_document_base* document = dynamic_cast(Context.root()->get_impl()->get_content()); + office_automatic_styles* styles = dynamic_cast(document->office_automatic_styles_.get()); + styles->styles_.style_style_.push_back(office_element_ptr(def_style)); + style_table_cell_properties* props = def_style->content_.get_style_table_cell_properties(true); + + def_style->content_.style_family_ = odf_types::style_family::TableCell; + + props->attlist_.common_padding_attlist_.fo_padding_left_ = length(3600 / 12700., length::pt); + props->attlist_.common_padding_attlist_.fo_padding_right_ = length(3600 / 12700., length::pt); + + Context.root()->odf_context().styleContainer().add_style(L"", L"", &(def_style->content_), false, true, L"", L"", L"", L"", L"default"); + + style_inst = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::TableCell); + } + if (style_inst) + { + style_table_cell_properties* props = style_inst->content()->get_style_table_cell_properties(true); + + if (!props->attlist_.common_padding_attlist_.fo_padding_left_) + props->attlist_.common_padding_attlist_.fo_padding_left_ = length(3600 / 12700., length::pt); + if (!props->attlist_.common_padding_attlist_.fo_padding_right_) + props->attlist_.common_padding_attlist_.fo_padding_right_ = length(3600 / 12700., length::pt); + + style_instances.push_back(style_inst); + } style_name = Context.get_table_context().get_default_cell_style(); if (!style_name.empty()) {