From e1237b99e2f7e22d1c679daf0ef1fa2577fa7a15 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Thu, 5 Sep 2019 12:30:22 +0300 Subject: [PATCH] x2t - fix after testing --- ASCOfficeDocxFile2/BinWriter/BinWriters.cpp | 4 +- .../OdfFileWTest/OdfFileWTest.vcproj | 2 +- .../source/OdfFormat/odf_settings_context.cpp | 10 ++--- .../source/Oox2OdfConverter/XlsxConverter.cpp | 35 +++++++++++---- .../XlsFormatTest/XlsFormatTest.sln | 44 ------------------- .../XlsFormatTest/XlsFormatTest.vcproj | 6 +-- .../XlsFormat/Logic/Biff_records/SupBook.cpp | 2 + 7 files changed, 39 insertions(+), 64 deletions(-) diff --git a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp index c04bcb6620..dcc0e26d9e 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp +++ b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp @@ -3236,7 +3236,8 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile) { switch(OfficeFileFormatChecker.nFileType) { - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: +#ifndef DONT_USED_EXTRA_LIBRARY + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT: { #ifndef _IOS @@ -3257,6 +3258,7 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile) result = (S_OK == rtfConvert.ConvertRtfToOOX(file_name_inp, sResultDocxDir)); }break; +#endif case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX: diff --git a/ASCOfficeOdfFileW/OdfFileWTest/OdfFileWTest.vcproj b/ASCOfficeOdfFileW/OdfFileWTest/OdfFileWTest.vcproj index 318cfcb77a..00fd6b3dc9 100644 --- a/ASCOfficeOdfFileW/OdfFileWTest/OdfFileWTest.vcproj +++ b/ASCOfficeOdfFileW/OdfFileWTest/OdfFileWTest.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/freetype-2.5.2/include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_USED_EXTRA_LIBRARY" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp index 17fb9c0ed7..0c3183e48b 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp @@ -150,11 +150,6 @@ void odf_settings_context::process_office_settings(office_element_ptr root ) views_elm->add_child_element(views_entry_elm); } - for (size_t i = 0; i < views_[v].content.size(); i++) - { - views_entry_elm->add_child_element(views_[v].content[i]); - } - if (!views_[v].tables.empty()) { office_element_ptr tables_elm; @@ -179,6 +174,11 @@ void odf_settings_context::process_office_settings(office_element_ptr root ) } } } + + for (size_t i = 0; i < views_[v].content.size(); i++) + { + views_entry_elm->add_child_element(views_[v].content[i]); + } } } if (!config_content_.empty()) diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp index b5f62feae2..0696f6bf30 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -1532,9 +1532,27 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) { ods_context->settings_context()->add_property(L"GridColor", L"int", sheet_view->m_oColorId->ToString()); } + bool bPaneX = false; bool bPaneY = false; int ActiveCellX = -1, ActiveCellY = -1; + int topLeftCellX = -1, topLeftCellY = -1; + + if (sheet_view->m_oTopLeftCell.IsInit()) + { + std::wstring ref(sheet_view->m_oTopLeftCell.get()); + odf_writer::utils::parsing_ref (ref, topLeftCellX, topLeftCellY); + } + if (topLeftCellX > 0 && topLeftCellY > 0) + { + ods_context->settings_context()->add_property(L"PositionLeft", L"int", std::to_wstring(topLeftCellX - 1)); + ods_context->settings_context()->add_property(L"PositionTop", L"int", std::to_wstring(topLeftCellY - 1)); + } + else + { + ods_context->settings_context()->add_property(L"PositionLeft", L"int", std::to_wstring(0)); + ods_context->settings_context()->add_property(L"PositionTop", L"int", std::to_wstring(0)); + } for (size_t j = 0; j < sheet_view->m_arrItems.size(); j++) { @@ -1548,10 +1566,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) if (ActiveCellX > 0 && ActiveCellY > 0) { ods_context->settings_context()->add_property(L"CursorPositionX", L"int", std::to_wstring(ActiveCellX - 1)); - ods_context->settings_context()->add_property(L"CursorPositionY", L"int", std::to_wstring(ActiveCellY - 1)); - ods_context->settings_context()->add_property(L"PositionLeft", L"int", std::to_wstring(0)); + ods_context->settings_context()->add_property(L"CursorPositionY", L"int", std::to_wstring(ActiveCellY - 1)); ods_context->settings_context()->add_property(L"PositionRight", L"int", std::to_wstring(0)); - ods_context->settings_context()->add_property(L"PositionTop", L"int", std::to_wstring(0)); ods_context->settings_context()->add_property(L"PositionBottom", L"int", std::to_wstring(ActiveCellY > 30 ? ActiveCellY - 2 : 0)); } } @@ -1563,8 +1579,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) break; // в OpenOffice нет множественного селекта } if (sheet_view->m_oPane.IsInit()) - { - + { if (sheet_view->m_oPane->m_oXSplit.IsInit()) { std::wstring sVal = std::to_wstring((int)sheet_view->m_oPane->m_oXSplit->GetValue()); @@ -1626,7 +1641,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) //nullable> m_oDefaultGridColor; //nullable> m_oShowRuler; //nullable> m_oShowWhiteSpace; - //nullable m_oTopLeftCell; //nullable> m_oView; //nullable> m_oWindowProtection; //nullable> m_oZoomScaleNormal; @@ -1725,7 +1739,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageMargins *oox_page) void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_pr) { if (!oox_sheet_format_pr)return; - //nullable> m_oBaseColWidth; //nullable> m_oCustomHeight; //nullable> m_oOutlineLevelCol; //nullable> m_oOutlineLevelRow; @@ -1759,8 +1772,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p if (oox_sheet_format_pr->m_oDefaultColWidth.IsInit()) { width = oox_sheet_format_pr->m_oDefaultColWidth->GetValue(); + width = ods_context->convert_symbol_width(width) + 5 * 3 / 4.; + //defaultColWidth = baseColumnWidth + {margin padding (2 pixels on each side, totalling 4 pixels)} + {gridline (1pixel)} + } + else if (oox_sheet_format_pr->m_oBaseColWidth.IsInit()) + { + width = oox_sheet_format_pr->m_oBaseColWidth->GetValue(); + width = ods_context->convert_symbol_width(width); } - width = ods_context->convert_symbol_width(width); ods_context->current_table().defaut_column_width_ = width;//pt column_properties->style_table_column_properties_attlist_.style_column_width_ = odf_types::length(odf_types::length(width,odf_types::length::pt).get_value_unit(odf_types::length::cm),odf_types::length::cm); } diff --git a/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.sln b/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.sln index f3c46fcfbe..96db497881 100644 --- a/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.sln +++ b/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.sln @@ -12,8 +12,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormatTest", "XlsFormatTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}" ProjectSection(ProjectDependencies) = postProject {36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302} - {AF2D00A7-A351-4700-AE88-C1D9ADE29345} = {AF2D00A7-A351-4700-AE88-C1D9ADE29345} - {C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383} {A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0} {CBEDD0D1-10A8-45C1-AF81-8492F40964CA} = {CBEDD0D1-10A8-45C1-AF81-8492F40964CA} EndProjectSection @@ -29,10 +27,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "..\..\Common\3dParty\cryptopp\cryptlib.vcproj", "{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtfFormatLib", "..\..\..\core\ASCOfficeRtfFile\RtfFormatLib\Win32\RtfFormatLib.vcproj", "{AF2D00A7-A351-4700-AE88-C1D9ADE29345}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\..\..\core\ASCOfficeDocFile\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -179,44 +173,6 @@ Global {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.ReleaseOpenSource|Win32.ActiveCfg = Release|x64 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.ReleaseOpenSource|x64.ActiveCfg = Release|x64 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.ReleaseOpenSource|x64.Build.0 = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Debug|Win32.ActiveCfg = Debug|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Debug|Win32.Build.0 = Debug|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Debug|x64.ActiveCfg = Debug|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Debug|x64.Build.0 = Debug|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Debug|Win32.Build.0 = Debug|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Debug|x64.ActiveCfg = Debug|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Debug|x64.Build.0 = Debug|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Release|Win32.ActiveCfg = Release|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Release|Win32.Build.0 = Release|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Release|x64.ActiveCfg = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.DLL-Import Release|x64.Build.0 = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Release|Win32.ActiveCfg = Release|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Release|Win32.Build.0 = Release|Win32 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Release|x64.ActiveCfg = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.Release|x64.Build.0 = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.ReleaseOpenSource|Win32.ActiveCfg = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.ReleaseOpenSource|x64.ActiveCfg = Release|x64 - {AF2D00A7-A351-4700-AE88-C1D9ADE29345}.ReleaseOpenSource|x64.Build.0 = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Debug|Win32.ActiveCfg = Debug|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Debug|Win32.Build.0 = Debug|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Debug|x64.ActiveCfg = Debug|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Debug|x64.Build.0 = Debug|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Debug|Win32.Build.0 = Debug|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Debug|x64.ActiveCfg = Debug|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Debug|x64.Build.0 = Debug|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Release|Win32.ActiveCfg = Release|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Release|Win32.Build.0 = Release|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Release|x64.ActiveCfg = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.DLL-Import Release|x64.Build.0 = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|Win32.ActiveCfg = Release|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|Win32.Build.0 = Release|Win32 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|x64.ActiveCfg = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|x64.Build.0 = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.ReleaseOpenSource|Win32.ActiveCfg = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.ReleaseOpenSource|x64.ActiveCfg = Release|x64 - {C5371405-338F-4B70-83BD-2A5CDF64F383}.ReleaseOpenSource|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj b/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj index c23e3dfc17..6d48c4096c 100644 --- a/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj +++ b/ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/freetype-2.5.2/include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;USE_LITE_READER;DONT_WRITE_EMBEDDED_FONTS" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;USE_LITE_READER;DONT_WRITE_EMBEDDED_FONTS;DONT_USED_EXTRA_LIBRARY" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -419,10 +419,6 @@ RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp" > - - diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SupBook.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SupBook.cpp index 68b45d8495..87d975a41b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SupBook.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SupBook.cpp @@ -166,6 +166,8 @@ void SupBook::readFields(CFRecord& record) { if (bPath) { + if (false == sResult.empty()) + virtPath.push_back(L""); virtPath.back() += L"/" + sResult; } else