Commit 79e05885 authored by ElenaSubbotina's avatar ElenaSubbotina

fix partly 35047

parent a3d08cfc
......@@ -2521,7 +2521,54 @@ namespace NExtractTools
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int html2doct_bin(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring sResultDoctDir = NSFile::GetDirectoryName(sTo);
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
return nRes;
}
int html2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
NSDirectory::CreateDirectory(sResultDoctDir);
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
return nRes;
}
int html2docx(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
NSDirectory::CreateDirectory(sResultDoctDir);
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sDocxDir);
nRes = doct_bin2docx_dir(sResultDoctFileEditor, L"", sDocxDir, false, L"", params);
if (SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sDocxDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
}
return nRes;
}
//------------------------------------------------------------------------------------------------------------------
int fromInputParams(InputParams& oInputParams)
{
TConversionDirection conversion = oInputParams.getConversionDirection();
......@@ -2828,6 +2875,26 @@ namespace NExtractTools
result = mscrypt2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
{
}break;
case TCD_HTML2DOCX:
{
result = html2docx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_HTML2DOCT:
{
result = html2doct (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_HTML2DOCT_BIN:
{
result = html2doct_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
//TCD_FB22DOCX,
//TCD_FB22DOCT,
//TCD_FB22DOCT_BIN,
//TCD_EPUB2DOCX,
//TCD_EPUB2DOCT,
//TCD_EPUB2DOCT_BIN,
}
// delete temp dir
......
......@@ -131,6 +131,10 @@ namespace NExtractTools
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int html2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int html2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int html2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
//-------------------------------------------------------------------------------------------------------------------------------------------------
int dir2zip (const std::wstring &sFrom, const std::wstring &sTo);
int zip2dir (const std::wstring &sFrom, const std::wstring &sTo);
......
......@@ -223,6 +223,24 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_MSCRYPT2PPTT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_MSCRYPT2BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_HTML2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_HTML2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_HTML2DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_FB22DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_FB22DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_FB22DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_EPUB2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_EPUB2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_EPUB2DOCT_BIN;
}break;
}
}
}
......
......@@ -136,7 +136,7 @@ namespace NExtractTools
TCD_PPTT2ODP,
TCD_PPTX_BIN2ODP,
TCD_XML2DOCX,
TCD_XML2DOCX,
TCD_DOCX2XML,
//
TCD_MSCRYPT2,
......@@ -145,6 +145,18 @@ namespace NExtractTools
TCD_MSCRYPT2PPTT,
TCD_MSCRYPT2BIN,
//
TCD_HTML2DOCX,
TCD_HTML2DOCT,
TCD_HTML2DOCT_BIN,
TCD_FB22DOCX,
TCD_FB22DOCT,
TCD_FB22DOCT_BIN,
TCD_EPUB2DOCX,
TCD_EPUB2DOCT,
TCD_EPUB2DOCT_BIN,
TCD_MAILMERGE,
TCD_T2,
TCD_DOCT_BIN2,
......
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