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
a197743a
Commit
a197743a
authored
Apr 27, 2016
by
konovalovsergey
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add param:password; error: drm, password
parent
39a3fd1b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
83 deletions
+110
-83
Common/OfficeFileErrorDescription.h
Common/OfficeFileErrorDescription.h
+2
-0
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+87
-71
X2tConverter/src/ASCConverters.h
X2tConverter/src/ASCConverters.h
+3
-3
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+16
-7
X2tConverter/src/main.cpp
X2tConverter/src/main.cpp
+2
-2
No files found.
Common/OfficeFileErrorDescription.h
View file @
a197743a
...
@@ -206,3 +206,5 @@
...
@@ -206,3 +206,5 @@
#define AVS_FILEUTILS_ERROR_CONVERT_LIBREOFFICE (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0057)
#define AVS_FILEUTILS_ERROR_CONVERT_LIBREOFFICE (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0057)
#define AVS_FILEUTILS_ERROR_CONVERT_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0058)
#define AVS_FILEUTILS_ERROR_CONVERT_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0058)
#define AVS_FILEUTILS_ERROR_CONVERT_NEED_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0059)
#define AVS_FILEUTILS_ERROR_CONVERT_NEED_PARAMS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0059)
#define AVS_FILEUTILS_ERROR_CONVERT_DRM (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005a)
#define AVS_FILEUTILS_ERROR_CONVERT_PASSWORD (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005b)
X2tConverter/src/ASCConverters.cpp
View file @
a197743a
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "../../DesktopEditor/doctrenderer/doctrenderer.h"
#include "../../DesktopEditor/doctrenderer/doctrenderer.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
#include "../../PdfReader/PdfReader.h"
#include "../../PdfReader/PdfReader.h"
#include "../../PdfReader/Src/ErrorConstants.h"
#include "../../DjVuFile/DjVu.h"
#include "../../DjVuFile/DjVu.h"
#include "../../XpsFile/XpsFile.h"
#include "../../XpsFile/XpsFile.h"
#include "../../HtmlRenderer/include/HTMLRenderer3.h"
#include "../../HtmlRenderer/include/HTMLRenderer3.h"
...
@@ -1337,36 +1338,77 @@ namespace NExtractTools
...
@@ -1337,36 +1338,77 @@ namespace NExtractTools
}
}
return
nRes
;
return
nRes
;
}
}
template
<
typename
T
>
int
PdfDjvuXpsToRenderer
(
IOfficeDrawingFile
**
ppReader
,
IRenderer
*
pRenderer
,
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
,
CApplicationFonts
*
pApplicationFonts
)
int
PdfDjvuXpsToRenderer
(
T
&
oReader
,
IRenderer
*
pRenderer
,
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
{
{
int
nRes
=
0
;
int
nRes
=
0
;
bool
bResult
=
oReader
.
LoadFromFile
(
sFrom
.
c_str
());
IOfficeDrawingFile
*
pReader
=
NULL
;
if
(
!
bResult
)
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF
==
nFormatFrom
)
{
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
pReader
=
new
PdfReader
::
CPdfReader
(
pApplicationFonts
);
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU
==
nFormatFrom
)
{
pReader
=
new
CDjVuFile
(
pApplicationFonts
);
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS
==
nFormatFrom
)
{
pReader
=
new
CXpsFile
(
pApplicationFonts
);
}
else
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
if
(
SUCCEEDED_X2T
(
nRes
))
{
*
ppReader
=
pReader
;
pReader
->
SetTempDirectory
(
sTemp
);
int
nPagesCount
=
oReader
.
GetPagesCount
();
std
::
wstring
sPassword
=
params
.
getPassword
();
for
(
int
i
=
0
;
i
<
nPagesCount
;
++
i
)
bool
bResult
=
pReader
->
LoadFromFile
(
sFrom
.
c_str
(),
L""
,
sPassword
,
sPassword
);
if
(
bResult
)
{
{
pRenderer
->
NewPage
();
int
nPagesCount
=
pReader
->
GetPagesCount
();
pRenderer
->
BeginCommand
(
c_nPageType
);
for
(
int
i
=
0
;
i
<
nPagesCount
;
++
i
)
{
pRenderer
->
NewPage
();
pRenderer
->
BeginCommand
(
c_nPageType
);
double
dPageDpiX
,
dPageDpiY
;
double
dPageDpiX
,
dPageDpiY
;
double
dWidth
,
dHeight
;
double
dWidth
,
dHeight
;
oReader
.
GetPageInfo
(
i
,
&
dWidth
,
&
dHeight
,
&
dPageDpiX
,
&
dPageDpiY
);
pReader
->
GetPageInfo
(
i
,
&
dWidth
,
&
dHeight
,
&
dPageDpiX
,
&
dPageDpiY
);
dWidth
*=
25.4
/
dPageDpiX
;
dWidth
*=
25.4
/
dPageDpiX
;
dHeight
*=
25.4
/
dPageDpiY
;
dHeight
*=
25.4
/
dPageDpiY
;
pRenderer
->
put_Width
(
dWidth
);
pRenderer
->
put_Width
(
dWidth
);
pRenderer
->
put_Height
(
dHeight
);
pRenderer
->
put_Height
(
dHeight
);
oReader
.
DrawPageOnRenderer
(
pRenderer
,
i
,
NULL
);
pReader
->
DrawPageOnRenderer
(
pRenderer
,
i
,
NULL
);
pRenderer
->
EndCommand
(
c_nPageType
);
}
pRenderer
->
EndCommand
(
c_nPageType
);
}
}
else
{
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF
==
nFormatFrom
)
{
PdfReader
::
CPdfReader
*
pPdfReader
=
static_cast
<
PdfReader
::
CPdfReader
*>
(
pReader
);
if
(
PdfReader
::
errorEncrypted
==
pPdfReader
->
GetError
())
{
if
(
sPassword
.
empty
())
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
nRes
=
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
else
{
nRes
=
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
}
}
}
}
return
nRes
;
return
nRes
;
}
}
...
@@ -1584,7 +1626,7 @@ namespace NExtractTools
...
@@ -1584,7 +1626,7 @@ namespace NExtractTools
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
return
nRes
;
return
nRes
;
}
}
int
fromSpreadsheet
(
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
)
int
fromSpreadsheet
(
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
)
{
{
int
nRes
=
0
;
int
nRes
=
0
;
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV
==
nFormatFrom
)
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV
==
nFormatFrom
)
...
@@ -1616,7 +1658,7 @@ namespace NExtractTools
...
@@ -1616,7 +1658,7 @@ namespace NExtractTools
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS
==
nFormatFrom
)
else
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS
==
nFormatFrom
)
{
{
nRes
=
xls2xlsx_dir
(
sFrom
,
sXlsxDir
,
s
Password
,
sTemp
,
sFontPath
);
nRes
=
xls2xlsx_dir
(
sFrom
,
sXlsxDir
,
s
Temp
,
sFontPath
,
params
);
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS
==
nFormatFrom
)
else
if
(
AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS
==
nFormatFrom
)
{
{
...
@@ -1763,28 +1805,10 @@ namespace NExtractTools
...
@@ -1763,28 +1805,10 @@ namespace NExtractTools
{
{
CPdfRenderer
pdfWriter
(
&
oApplicationFonts
);
CPdfRenderer
pdfWriter
(
&
oApplicationFonts
);
pdfWriter
.
SetTempFolder
(
sTemp
);
pdfWriter
.
SetTempFolder
(
sTemp
);
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF
==
nFormatFrom
)
IOfficeDrawingFile
*
pReader
=
NULL
;
{
nRes
=
PdfDjvuXpsToRenderer
(
&
pReader
,
&
pdfWriter
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
,
params
,
&
oApplicationFonts
);
PdfReader
::
CPdfReader
oReader
(
&
oApplicationFonts
);
pdfWriter
.
SaveToFile
(
sTo
);
oReader
.
SetTempDirectory
(
sTemp
);
RELEASEOBJECT
(
pReader
);
nRes
=
PdfDjvuXpsToRenderer
<
PdfReader
::
CPdfReader
>
(
oReader
,
&
pdfWriter
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
pdfWriter
.
SaveToFile
(
sTo
);
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU
==
nFormatFrom
)
{
CDjVuFile
oReader
(
&
oApplicationFonts
);
nRes
=
PdfDjvuXpsToRenderer
<
CDjVuFile
>
(
oReader
,
&
pdfWriter
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
pdfWriter
.
SaveToFile
(
sTo
);
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS
==
nFormatFrom
)
{
CXpsFile
oReader
(
&
oApplicationFonts
);
oReader
.
SetTempDirectory
(
sTemp
);
nRes
=
PdfDjvuXpsToRenderer
<
CXpsFile
>
(
oReader
,
&
pdfWriter
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
pdfWriter
.
SaveToFile
(
sTo
);
}
else
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_CANVAS_WORD
==
nFormatTo
)
else
if
(
AVS_OFFICESTUDIO_FILE_CANVAS_WORD
==
nFormatTo
)
...
@@ -1798,28 +1822,10 @@ namespace NExtractTools
...
@@ -1798,28 +1822,10 @@ namespace NExtractTools
}
}
NSHtmlRenderer
::
CASCHTMLRenderer3
oHtmlRenderer
;
NSHtmlRenderer
::
CASCHTMLRenderer3
oHtmlRenderer
;
oHtmlRenderer
.
CreateOfficeFile
(
sToDir
,
sFontPath
);
oHtmlRenderer
.
CreateOfficeFile
(
sToDir
,
sFontPath
);
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF
==
nFormatFrom
)
IOfficeDrawingFile
*
pReader
=
NULL
;
{
nRes
=
PdfDjvuXpsToRenderer
(
&
pReader
,
&
oHtmlRenderer
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
,
params
,
&
oApplicationFonts
);
PdfReader
::
CPdfReader
oReader
(
&
oApplicationFonts
);
oHtmlRenderer
.
CloseFile
();
oReader
.
SetTempDirectory
(
sTemp
);
RELEASEOBJECT
(
pReader
);
nRes
=
PdfDjvuXpsToRenderer
<
PdfReader
::
CPdfReader
>
(
oReader
,
&
oHtmlRenderer
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
oHtmlRenderer
.
CloseFile
();
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU
==
nFormatFrom
)
{
CDjVuFile
oReader
(
&
oApplicationFonts
);
nRes
=
PdfDjvuXpsToRenderer
<
CDjVuFile
>
(
oReader
,
&
oHtmlRenderer
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
oHtmlRenderer
.
CloseFile
();
}
else
if
(
AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS
==
nFormatFrom
)
{
CXpsFile
oReader
(
&
oApplicationFonts
);
oReader
.
SetTempDirectory
(
sTemp
);
nRes
=
PdfDjvuXpsToRenderer
<
CXpsFile
>
(
oReader
,
&
oHtmlRenderer
,
sFrom
,
nFormatFrom
,
sTo
,
sTemp
,
sFontPath
);
oHtmlRenderer
.
CloseFile
();
}
else
nRes
=
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
else
else
{
{
...
@@ -1842,13 +1848,13 @@ namespace NExtractTools
...
@@ -1842,13 +1848,13 @@ namespace NExtractTools
}
}
// xls -> xlsx
// xls -> xlsx
int
xls2xlsx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
int
xls2xlsx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
)
{
{
std
::
wstring
sResultDocxDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"xlsx_unpacked"
);
std
::
wstring
sResultDocxDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"xlsx_unpacked"
);
FileSystem
::
Directory
::
CreateDirectory
(
sResultDocxDir
);
FileSystem
::
Directory
::
CreateDirectory
(
sResultDocxDir
);
int
nRes
=
xls2xlsx_dir
(
sFrom
,
sResultDocxDir
,
s
Password
,
sFontPath
,
sTemp
);
int
nRes
=
xls2xlsx_dir
(
sFrom
,
sResultDocxDir
,
s
FontPath
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
if
(
SUCCEEDED_X2T
(
nRes
))
{
{
COfficeUtils
oCOfficeUtils
(
NULL
);
COfficeUtils
oCOfficeUtils
(
NULL
);
...
@@ -1857,9 +1863,19 @@ namespace NExtractTools
...
@@ -1857,9 +1863,19 @@ namespace NExtractTools
}
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
int
xls2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
int
xls2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
)
{
{
return
S_OK
==
ConvertXls2Xlsx
(
sFrom
,
sTo
,
sPassword
,
sFontPath
,
NULL
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
long
hRes
=
ConvertXls2Xlsx
(
sFrom
,
sTo
,
params
.
getPassword
(),
sFontPath
,
NULL
);
if
(
AVS_ERROR_DRM
==
hRes
)
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
else
if
(
AVS_ERROR_PASSWORD
==
hRes
)
{
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
return
0
==
hRes
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
// xls -> xlst
// xls -> xlst
...
...
X2tConverter/src/ASCConverters.h
View file @
a197743a
...
@@ -63,8 +63,8 @@ namespace NExtractTools
...
@@ -63,8 +63,8 @@ namespace NExtractTools
int
doc2doct_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
doc2doct_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
docx_dir2doc
(
const
std
::
wstring
&
sDocxDir
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
docx_dir2doc
(
const
std
::
wstring
&
sDocxDir
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
xls2xlsx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
xls2xlsx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
);
int
xls2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
);
int
xls2xlsx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
);
int
xls2xlst
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sPassword
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
);
int
xls2xlst
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sPassword
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
);
int
xls2xlst_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sPassword
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
);
int
xls2xlst_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sPassword
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
);
...
@@ -95,7 +95,7 @@ namespace NExtractTools
...
@@ -95,7 +95,7 @@ namespace NExtractTools
int
fromXlsxDir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromXlsxDir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromXlstBin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromXlstBin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromSpreadsheet
(
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromSpreadsheet
(
const
std
::
wstring
&
sFrom
,
int
nFormatFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromPptxDir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromPptxDir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromPpttBin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
int
fromPpttBin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
int
nFormatTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
std
::
wstring
&
sXmlOptions
,
const
std
::
wstring
&
sThemeDir
,
bool
bFromChanges
,
bool
bPaid
,
const
InputParams
&
params
);
...
...
X2tConverter/src/cextracttools.h
View file @
a197743a
...
@@ -123,7 +123,13 @@ namespace NExtractTools
...
@@ -123,7 +123,13 @@ namespace NExtractTools
TCSVD_COMMA
=
4
,
TCSVD_COMMA
=
4
,
TCSVD_SPACE
=
5
TCSVD_SPACE
=
5
}
TCsvDelimiter
;
}
TCsvDelimiter
;
static
bool
copyOrigin
(
const
std
::
wstring
&
sFileFrom
,
const
std
::
wstring
&
sFileTo
)
{
size_t
nIndex
=
sFileFrom
.
rfind
(
'.'
);
return
NSFile
::
CFileBinary
::
Copy
(
sFileFrom
,
NSSystemPath
::
GetDirectoryName
(
sFileTo
)
+
FILE_SEPARATOR_STR
+
_T
(
"origin"
)
+
sFileFrom
.
substr
(
nIndex
));
}
class
InputParamsMailMerge
class
InputParamsMailMerge
{
{
public:
public:
...
@@ -235,6 +241,7 @@ namespace NExtractTools
...
@@ -235,6 +241,7 @@ namespace NExtractTools
InputParamsMailMerge
*
m_oMailMergeSend
;
InputParamsMailMerge
*
m_oMailMergeSend
;
int
*
m_nDoctParams
;
int
*
m_nDoctParams
;
std
::
wstring
*
m_sHtmlFileInternalPath
;
std
::
wstring
*
m_sHtmlFileInternalPath
;
std
::
wstring
*
m_sPassword
;
public:
public:
InputParams
()
InputParams
()
{
{
...
@@ -254,6 +261,7 @@ namespace NExtractTools
...
@@ -254,6 +261,7 @@ namespace NExtractTools
m_oMailMergeSend
=
NULL
;
m_oMailMergeSend
=
NULL
;
m_nDoctParams
=
NULL
;
m_nDoctParams
=
NULL
;
m_sHtmlFileInternalPath
=
NULL
;
m_sHtmlFileInternalPath
=
NULL
;
m_sPassword
=
NULL
;
}
}
~
InputParams
()
~
InputParams
()
{
{
...
@@ -273,6 +281,7 @@ namespace NExtractTools
...
@@ -273,6 +281,7 @@ namespace NExtractTools
RELEASEOBJECT
(
m_oMailMergeSend
);
RELEASEOBJECT
(
m_oMailMergeSend
);
RELEASEOBJECT
(
m_nDoctParams
);
RELEASEOBJECT
(
m_nDoctParams
);
RELEASEOBJECT
(
m_sHtmlFileInternalPath
);
RELEASEOBJECT
(
m_sHtmlFileInternalPath
);
RELEASEOBJECT
(
m_sPassword
);
}
}
bool
FromXmlFile
(
std
::
wstring
sFilename
)
bool
FromXmlFile
(
std
::
wstring
sFilename
)
...
@@ -329,6 +338,8 @@ namespace NExtractTools
...
@@ -329,6 +338,8 @@ namespace NExtractTools
m_nDoctParams
=
new
int
(
XmlUtils
::
GetInteger
(
sValue
));
m_nDoctParams
=
new
int
(
XmlUtils
::
GetInteger
(
sValue
));
else
if
(
_T
(
"m_sHtmlFileInternalPath"
)
==
sName
)
else
if
(
_T
(
"m_sHtmlFileInternalPath"
)
==
sName
)
m_sHtmlFileInternalPath
=
new
std
::
wstring
(
sValue
);
m_sHtmlFileInternalPath
=
new
std
::
wstring
(
sValue
);
else
if
(
_T
(
"m_sPassword"
)
==
sName
)
m_sPassword
=
new
std
::
wstring
(
sValue
);
}
}
}
}
}
}
...
@@ -337,9 +348,9 @@ namespace NExtractTools
...
@@ -337,9 +348,9 @@ namespace NExtractTools
}
}
return
true
;
return
true
;
}
}
std
::
wstring
getPassword
()
std
::
wstring
getPassword
()
const
{
{
return
L""
;
return
(
NULL
!=
m_sPassword
)
?
(
*
m_sPassword
)
:
L""
;
}
}
std
::
wstring
getXmlOptions
()
std
::
wstring
getXmlOptions
()
...
@@ -445,8 +456,7 @@ namespace NExtractTools
...
@@ -445,8 +456,7 @@ namespace NExtractTools
{
{
if
(
!
getDontSaveAdditional
())
if
(
!
getDontSaveAdditional
())
{
{
size_t
nIndex
=
m_sFileFrom
->
rfind
(
'.'
);
copyOrigin
(
*
m_sFileFrom
,
*
m_sFileTo
);
NSFile
::
CFileBinary
::
Copy
(
*
m_sFileFrom
,
NSSystemPath
::
GetDirectoryName
(
*
m_sFileTo
)
+
FILE_SEPARATOR_STR
+
_T
(
"origin"
)
+
m_sFileFrom
->
substr
(
nIndex
));
}
}
eRes
=
TCD_ERROR
;
eRes
=
TCD_ERROR
;
}
}
...
@@ -467,8 +477,7 @@ namespace NExtractTools
...
@@ -467,8 +477,7 @@ namespace NExtractTools
oBuilder
.
WriteString
(
_T
(
"}"
));
oBuilder
.
WriteString
(
_T
(
"}"
));
std
::
wstring
sFilePath
=
NSSystemPath
::
GetDirectoryName
(
*
m_sFileTo
)
+
FILE_SEPARATOR_STR
+
_T
(
"settings.json"
);
std
::
wstring
sFilePath
=
NSSystemPath
::
GetDirectoryName
(
*
m_sFileTo
)
+
FILE_SEPARATOR_STR
+
_T
(
"settings.json"
);
NSFile
::
CFileBinary
::
SaveToFile
(
sFilePath
,
oBuilder
.
GetData
());
NSFile
::
CFileBinary
::
SaveToFile
(
sFilePath
,
oBuilder
.
GetData
());
size_t
nIndex
=
m_sFileFrom
->
rfind
(
'.'
);
copyOrigin
(
*
m_sFileFrom
,
*
m_sFileTo
);
NSFile
::
CFileBinary
::
Copy
(
*
m_sFileFrom
,
NSSystemPath
::
GetDirectoryName
(
*
m_sFileTo
)
+
FILE_SEPARATOR_STR
+
_T
(
"origin"
)
+
m_sFileFrom
->
substr
(
nIndex
));
}
}
eRes
=
TCD_ERROR
;
eRes
=
TCD_ERROR
;
}
}
...
...
X2tConverter/src/main.cpp
View file @
a197743a
...
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
...
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
}
}
else
if
(
TCD_XLS2XLSX
==
conversion
)
else
if
(
TCD_XLS2XLSX
==
conversion
)
{
{
result
=
xls2xlsx
(
sFileFrom
,
sFileTo
,
s
Password
,
sTempDir
,
sFontPath
);
result
=
xls2xlsx
(
sFileFrom
,
sFileTo
,
s
TempDir
,
sFontPath
,
oInputParams
);
}
}
else
if
(
TCD_XLS2XLST
==
conversion
)
else
if
(
TCD_XLS2XLST
==
conversion
)
{
{
...
@@ -381,7 +381,7 @@ int main(int argc, char *argv[])
...
@@ -381,7 +381,7 @@ int main(int argc, char *argv[])
}
}
else
if
(
TCD_SPREADSHEET2
==
conversion
)
else
if
(
TCD_SPREADSHEET2
==
conversion
)
{
{
result
=
fromSpreadsheet
(
sFileFrom
,
nFormatFrom
,
sFileTo
,
nFormatTo
,
s
Password
,
s
TempDir
,
sFontPath
,
sXmlOptions
,
sThemeDir
,
bFromChanges
,
bPaid
,
oInputParams
);
result
=
fromSpreadsheet
(
sFileFrom
,
nFormatFrom
,
sFileTo
,
nFormatTo
,
sTempDir
,
sFontPath
,
sXmlOptions
,
sThemeDir
,
bFromChanges
,
bPaid
,
oInputParams
);
}
}
else
if
(
TCD_PRESENTATION2
==
conversion
)
else
if
(
TCD_PRESENTATION2
==
conversion
)
{
{
...
...
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