Commit 903236d8 authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent 15bd732b
......@@ -160,7 +160,8 @@ namespace PPTX
COfficeFileFormatChecker office_checker;
office_checker.isOOXFormatFile(oox_file.GetPath());
//if ( std::wstring::npos != sProgID.find(L"Word.Document"))
if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX)
if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM )
{
pWriter->StartRecord(1);
pWriter->WriteBYTE(1);
......@@ -189,7 +190,8 @@ namespace PPTX
*pWriter->m_pCurrentContainer = old_rels;
pWriter->m_pMainDocument = old_serial;
}
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX)
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!
{
pWriter->StartRecord(1);
......
......@@ -51,18 +51,26 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT convert_single(std::wstring fileName)
HRESULT convert_single(std::wstring srcFileName)
{
HRESULT hr = S_OK;
std::wstring srcFileName = fileName;
std::wstring dstPath = srcFileName + L"-my.xlsx";
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstPath;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL, true);
bool bMacros = true;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL, bMacros);
if (bMacros)
{
dstPath = srcFileName + L"-my.xlsm";
}
else
{
dstPath = srcFileName + L"-my.xlsx";
}
if (hr == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
......@@ -71,6 +79,7 @@ HRESULT convert_single(std::wstring fileName)
NSDirectory::DeleteDirectory(dstTempPath);
return hr;
}
......
......@@ -36,7 +36,7 @@
#include "../../../Common/OfficeFileErrorDescription.h"
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack, bool bMacros)
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack, bool &bMacros)
{
XlsConverter converter(srcFile, dstPath, password, fontsPath, pCallBack, bMacros);
......
......@@ -33,4 +33,4 @@
struct ProgressCallback;
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack, bool bMacros);
\ No newline at end of file
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack, bool & bMacros);
\ No newline at end of file
......@@ -121,7 +121,7 @@ typedef struct tagBITMAPCOREHEADER {
} BITMAPCOREHEADER;
#endif
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool bMacros)
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool & bMacros)
{
xlsx_path = _xlsx_path;
output_document = NULL;
......@@ -239,6 +239,8 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
output_document->get_xl_files().add_vba_project();
}
}
else
bMacros = false;
}
catch(...)
{
......
......@@ -93,7 +93,7 @@ namespace ODRAW
class XlsConverter
{
public:
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool bMacros);
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context;
......
This diff is collapsed.
......@@ -55,12 +55,14 @@ namespace NExtractTools
int doct_bin2docx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int doct2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int dotx2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotm2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotm2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotx2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int docm2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int docm2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotm2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotm2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions);
......@@ -75,6 +77,8 @@ namespace NExtractTools
int xltm2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsm2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsm2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xltm2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xltm2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptx2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......@@ -100,6 +104,8 @@ namespace NExtractTools
int potm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int potm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
......@@ -123,6 +123,8 @@ namespace NExtractTools
res = TCD_DOTX2DOCX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM)
res = TCD_DOCM2DOCX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM)
res = TCD_DOTM2DOCX;
}
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM;
}break;
......@@ -141,6 +143,8 @@ namespace NExtractTools
res = TCD_XLTX2XLSX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
res = TCD_XLSM2XLSX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM)
res = TCD_XLTM2XLSX;
}
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM;
}break;
......@@ -160,6 +164,8 @@ namespace NExtractTools
res = TCD_POTX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM)
res = TCD_PPTM2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM)
res = TCD_POTM2PPTX;
}
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_POTM2PPTM;
else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP;
......
......@@ -64,6 +64,7 @@ namespace NExtractTools
TCD_DOCT_BIN2DOCX,
TCD_DOTX2DOCX,
TCD_DOCM2DOCX,
TCD_DOTM2DOCX,
TCD_DOTM2DOCM,
TCD_XLSX2XLST,
......@@ -72,6 +73,7 @@ namespace NExtractTools
TCD_XLST_BIN2XLSX,
TCD_XLTX2XLSX,
TCD_XLSM2XLSX,
TCD_XLTM2XLSX,
TCD_XLTM2XLSM,
TCD_PPTX2PPTT,
......@@ -81,6 +83,7 @@ namespace NExtractTools
TCD_PPSX2PPTX,
TCD_POTX2PPTX,
TCD_PPTM2PPTX,
TCD_POTM2PPTX,
TCD_POTM2PPTM,
TCD_ZIPDIR,
......
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