diff --git a/DesktopEditor/doctrenderer/docbuilder_p.h b/DesktopEditor/doctrenderer/docbuilder_p.h index 46a7ce69ab..2fbdea035f 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.h +++ b/DesktopEditor/doctrenderer/docbuilder_p.h @@ -58,6 +58,7 @@ #endif #include "../fontengine/ApplicationFontsWorker.h" +#include "../../OfficeUtils/src/OfficeUtils.h" #ifdef CreateFile #undef CreateFile @@ -1159,6 +1160,27 @@ namespace NSDoctRenderer } #endif + // html correct (TODO: move to x2t) + if (0 == nReturnCode && type == AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER) + { + COfficeUtils oUtils; + if (S_OK == oUtils.IsArchive(_path)) + { + std::wstring sTmpFile = sDstTmpDir + L"/tmp_html"; + NSDirectory::CreateDirectory(sTmpFile); + if (S_OK == oUtils.ExtractToDirectory(_path, sTmpFile, NULL, 0)) + { + std::vector arFiles = NSDirectory::GetFiles(sTmpFile); + if (arFiles.size() == 1) + { + NSFile::CFileBinary::Remove(_path); + NSFile::CFileBinary::Move(arFiles[0], _path); + } + } + } + } + + NSDirectory::DeleteDirectory(sDstTmpDir); NSFile::CFileBinary::Remove(sTempFileForParams);