Skip to content

Commit

Permalink
fix bug #66497
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaSubbotina committed Feb 14, 2024
1 parent 8a88fce commit ae8b458
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions X2tConverter/src/lib/pdf_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,10 @@ namespace NExtractTools
}

_UINT32 fromCrossPlatform(const std::wstring& sFromSrc, int nFormatFrom,
const std::wstring& sTo, int nFormatTo,
const std::wstring& sTo_, int nFormatTo,
InputParams& params, ConvertParams& convertParams)
{
std::wstring sTo = sTo_;
_UINT32 nRes = 0;
NSFonts::IApplicationFonts *pApplicationFonts = createApplicationFonts(params);

Expand Down Expand Up @@ -825,16 +826,25 @@ namespace NExtractTools
}
else
{
bool bChangeExt = false;
switch (nFormatTo)
{
case AVS_OFFICESTUDIO_FILE_OTHER_OOXML:
nFormatTo = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
*params.m_nFormatTo = nFormatTo = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; bChangeExt = true;
break;
case AVS_OFFICESTUDIO_FILE_OTHER_ODF:
nFormatTo = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT;
*params.m_nFormatTo = nFormatTo = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT; bChangeExt = true;
break;
}

if (bChangeExt)
{
size_t nIndex = sTo.rfind('.');
COfficeFileFormatChecker FileFormatChecker;
if (-1 != nIndex)
sTo.replace(nIndex, std::wstring::npos, FileFormatChecker.GetExtensionByType(*params.m_nFormatTo));
else
sTo.append(FileFormatChecker.GetExtensionByType(*params.m_nFormatTo));
}
IOfficeDrawingFile *pReader = NULL;
switch (nFormatFrom)
{
Expand Down Expand Up @@ -894,6 +904,7 @@ namespace NExtractTools

oDocxRenderer.SetTempFolder(sTempDirOut);
bool bIsOutCompress = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo && !params.hasSavePassword();

nRes = oDocxRenderer.Convert(pReader, sTo, bIsOutCompress);

if (nRes == S_OK && !bIsOutCompress)
Expand Down

0 comments on commit ae8b458

Please sign in to comment.