Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
903236d8
Commit
903236d8
authored
Sep 01, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
15bd732b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
288 additions
and
22 deletions
+288
-22
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
+4
-2
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
+15
-6
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.cpp
...fficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.cpp
+1
-1
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h
+1
-1
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+3
-1
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
+1
-1
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+246
-8
X2tConverter/src/ASCConverters.h
X2tConverter/src/ASCConverters.h
+8
-2
X2tConverter/src/cextracttools.cpp
X2tConverter/src/cextracttools.cpp
+6
-0
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+3
-0
No files found.
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
View file @
903236d8
...
...
@@ -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
);
...
...
ASCOfficeXlsFile2/XlsFormatTest/XlsFormatTest.cpp
View file @
903236d8
...
...
@@ -51,18 +51,26 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT
convert_single
(
std
::
wstring
f
ileName
)
HRESULT
convert_single
(
std
::
wstring
srcF
ileName
)
{
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
;
}
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.cpp
View file @
903236d8
...
...
@@ -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
);
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h
View file @
903236d8
...
...
@@ -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
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
903236d8
...
...
@@ -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
(...)
{
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h
View file @
903236d8
...
...
@@ -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
;
...
...
X2tConverter/src/ASCConverters.cpp
View file @
903236d8
...
...
@@ -342,6 +342,85 @@ namespace NExtractTools
std
::
wstring
sVbaDataPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"vbaData.xml"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaDataPath
);
}
return
0
;
}
// dotm -> docx
int
dotm2docx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
sTempUnpackedDOCX
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"docx_unpacked"
);
NSDirectory
::
CreateDirectory
(
sTempUnpackedDOCX
);
int
nRes
=
dotm2docx_dir
(
sFrom
,
sTempUnpackedDOCX
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sTempUnpackedDOCX
,
sTo
,
true
))
return
0
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
dotm2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sFrom
,
sTo
,
NULL
,
0
))
{
std
::
wstring
sContentTypesPath
=
sTo
+
FILE_SEPARATOR_STR
+
_T
(
"[Content_Types].xml"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sContentTypesPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-word.template.macroEnabledTemplate.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
);
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
sCTFrom
=
L"<Override PartName=
\"
/word/vbaProject.bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
sCTFrom
=
L"<Override PartName=
\"
/word/vbaData.xml
\"
ContentType=
\"
application/vnd.ms-word.vbaData+xml
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
sCTFrom
=
L"<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sContentTypesPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sDocumentRelsPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
L"document.xml.rels"
;
if
(
NSFile
::
CFileBinary
::
Exists
(
sDocumentRelsPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sDocumentRelsPath
,
sData
))
{
int
pos
=
sData
.
find
(
L"vbaProject.bin"
);
if
(
pos
>
0
)
{
int
pos1
=
sData
.
rfind
(
L"<"
,
pos
);
int
pos2
=
sData
.
find
(
L">"
,
pos
);
if
(
pos1
>
0
&&
pos2
>
0
)
{
sData
.
erase
(
sData
.
begin
()
+
pos1
,
sData
.
begin
()
+
pos2
+
1
);
}
}
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sDocumentRelsPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
std
::
wstring
sVbaProjectRelsPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin.rels"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectRelsPath
);
std
::
wstring
sVbaDataPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"word"
+
FILE_SEPARATOR_STR
+
L"vbaData.xml"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaDataPath
);
}
return
0
;
}
// dotm -> docm
...
...
@@ -615,6 +694,76 @@ namespace NExtractTools
}
return
0
;
}
// xltm -> xlsx
int
xltm2xlsx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
sTempUnpackedXLSX
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"xlsx_unpacked"
);
NSDirectory
::
CreateDirectory
(
sTempUnpackedXLSX
);
int
nRes
=
xltm2xlsx_dir
(
sFrom
,
sTempUnpackedXLSX
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sTempUnpackedXLSX
,
sTo
,
true
))
return
0
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
xltm2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sFrom
,
sTo
,
NULL
,
0
))
{
std
::
wstring
sContentTypesPath
=
sTo
+
FILE_SEPARATOR_STR
+
_T
(
"[Content_Types].xml"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sContentTypesPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
L"application/vnd.ms-excel.template.macroEnabled.main+xml"
;
std
::
wstring
sCTTo
=
L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
sCTFrom
=
L"<Override PartName=
\"
/xl/vbaProject.bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
sCTFrom
=
L"<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sContentTypesPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sWorkbookRelsPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"xl"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
L"workbook.xml.rels"
;
if
(
NSFile
::
CFileBinary
::
Exists
(
sWorkbookRelsPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sWorkbookRelsPath
,
sData
))
{
int
pos
=
sData
.
find
(
L"vbaProject.bin"
);
if
(
pos
>
0
)
{
int
pos1
=
sData
.
rfind
(
L"<"
,
pos
);
int
pos2
=
sData
.
find
(
L">"
,
pos
);
if
(
pos1
>
0
&&
pos2
>
0
)
{
sData
.
erase
(
sData
.
begin
()
+
pos1
,
sData
.
begin
()
+
pos2
+
1
);
}
}
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sWorkbookRelsPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"xl"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
}
return
0
;
}
// xltm -> xlsm
int
xltm2xlsm
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
...
...
@@ -641,8 +790,8 @@ namespace NExtractTools
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-excel.
sheet
.macroEnabled.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.ms-excel.
template
.macroEnabled.main+xml"
);
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-excel.
template
.macroEnabled.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.ms-excel.
sheet
.macroEnabled.main+xml"
);
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
...
...
@@ -1247,6 +1396,77 @@ namespace NExtractTools
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
}
return
0
;
}
// potm -> pptx
int
potm2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
sTempUnpackedPPTX
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"pptx_unpacked"
);
NSDirectory
::
CreateDirectory
(
sTempUnpackedPPTX
);
int
nRes
=
potm2pptx_dir
(
sFrom
,
sTempUnpackedPPTX
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sTempUnpackedPPTX
,
sTo
,
true
))
return
0
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
potm2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sFrom
,
sTo
,
NULL
,
0
))
{
std
::
wstring
sContentTypesPath
=
sTo
+
FILE_SEPARATOR_STR
+
_T
(
"[Content_Types].xml"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sContentTypesPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-powerpoint.template.macroEnabled.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
);
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
sCTFrom
=
L"<Override PartName=
\"
/ppt/vbaProject.bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
sCTFrom
=
L"<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sContentTypesPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sPresentationRelsPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
L"presentation.xml.rels"
;
if
(
NSFile
::
CFileBinary
::
Exists
(
sPresentationRelsPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sPresentationRelsPath
,
sData
))
{
int
pos
=
sData
.
find
(
L"vbaProject.bin"
);
if
(
pos
>
0
)
{
int
pos1
=
sData
.
rfind
(
L"<"
,
pos
);
int
pos2
=
sData
.
find
(
L">"
,
pos
);
if
(
pos1
>
0
&&
pos2
>
0
)
{
sData
.
erase
(
sData
.
begin
()
+
pos1
,
sData
.
begin
()
+
pos2
+
1
);
}
}
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sPresentationRelsPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
}
return
0
;
}
...
...
@@ -3134,7 +3354,9 @@ namespace NExtractTools
}
int
xls2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
long
hRes
=
ConvertXls2Xlsx
(
sFrom
,
sTo
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
false
);
bool
bMacros
=
false
;
long
hRes
=
ConvertXls2Xlsx
(
sFrom
,
sTo
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
bMacros
);
if
(
AVS_ERROR_DRM
==
hRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
...
...
@@ -3167,15 +3389,17 @@ namespace NExtractTools
}
int
xls2xlsm_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
long
hRes
=
ConvertXls2Xlsx
(
sFrom
,
sTo
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
true
);
if
(
AVS_ERROR_DRM
==
hRes
)
{
bool
bMacros
=
true
;
long
hRes
=
ConvertXls2Xlsx
(
sFrom
,
sTo
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
bMacros
);
if
(
AVS_ERROR_DRM
==
hRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
}
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
}
else
if
(
AVS_ERROR_PASSWORD
==
hRes
)
{
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
...
...
@@ -3209,7 +3433,9 @@ namespace NExtractTools
NSDirectory
::
CreateDirectory
(
sResultXlsxDir
);
if
(
ConvertXls2Xlsx
(
sFrom
,
sResultXlsxDir
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
true
)
==
S_OK
)
bool
bMacros
=
true
;
if
(
ConvertXls2Xlsx
(
sFrom
,
sResultXlsxDir
,
params
.
getPassword
(),
params
.
getFontPath
(),
NULL
,
bMacros
)
==
S_OK
)
{
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
...
...
@@ -3378,6 +3604,10 @@ namespace NExtractTools
{
result
=
docm2docx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_DOTM2DOCX
:
{
result
=
dotm2docx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_DOTM2DOCM
:
{
result
=
dotm2docm
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
...
...
@@ -3390,6 +3620,10 @@ namespace NExtractTools
{
result
=
xltx2xlsx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_XLTM2XLSX
:
{
result
=
xltm2xlsx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_XLTM2XLSM
:
{
result
=
xltm2xlsm
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
...
...
@@ -3402,6 +3636,10 @@ namespace NExtractTools
{
result
=
potx2pptx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_POTM2PPTX
:
{
result
=
potm2pptx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_POTM2PPTM
:
{
result
=
potm2pptm
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
...
...
X2tConverter/src/ASCConverters.h
View file @
903236d8
...
...
@@ -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
);
...
...
X2tConverter/src/cextracttools.cpp
View file @
903236d8
...
...
@@ -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
;
...
...
X2tConverter/src/cextracttools.h
View file @
903236d8
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment