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
62ea2bbc
Commit
62ea2bbc
authored
Jul 27, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editor.bin without base64
parent
4071fa31
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
243 additions
and
133 deletions
+243
-133
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+1
-0
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+2
-2
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
+49
-66
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
+2
-3
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
+7
-1
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
+2
-0
ASCOfficePPTXFile/ASCOfficePPTXFile.h
ASCOfficePPTXFile/ASCOfficePPTXFile.h
+2
-0
ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp
ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp
+7
-2
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
+2
-0
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+13
-2
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
+2
-1
ASCOfficePPTXFile/Editor/Converter.h
ASCOfficePPTXFile/Editor/Converter.h
+29
-17
ASCOfficePPTXFile/Editor/PPTXWriter.h
ASCOfficePPTXFile/Editor/PPTXWriter.h
+28
-7
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+25
-6
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+9
-0
XlsxSerializerCom/Common/BinReaderWriterDefines.h
XlsxSerializerCom/Common/BinReaderWriterDefines.h
+1
-0
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+25
-11
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+37
-15
No files found.
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
62ea2bbc
...
...
@@ -125,6 +125,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
const
static
wchar_t
*
g_sFormatSignature
=
L"DOCY"
;
const
int
g_nFormatVersion
=
5
;
const
int
g_nFormatVersionNoBase64
=
10
;
extern
int
g_nCurFormatVersion
;
namespace
c_oAscWrapStyle
{
enum
c_oSerFormat
{
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
62ea2bbc
...
...
@@ -7714,9 +7714,9 @@ namespace BinDocxRW
m_nLastFilePos
=
0
;
m_nRealTableCount
=
0
;
}
static
std
::
wstring
WriteFileHeader
(
long
nDataSize
)
static
std
::
wstring
WriteFileHeader
(
long
nDataSize
,
int
version
)
{
std
::
wstring
sHeader
=
std
::
wstring
(
g_sFormatSignature
)
+
L";v"
+
std
::
to_wstring
(
g_nFormatV
ersion
)
+
L";"
+
std
::
to_wstring
(
nDataSize
)
+
L";"
;
std
::
wstring
sHeader
=
std
::
wstring
(
g_sFormatSignature
)
+
L";v"
+
std
::
to_wstring
(
v
ersion
)
+
L";"
+
std
::
to_wstring
(
nDataSize
)
+
L";"
;
return
sHeader
;
}
void
WriteMainTableStart
()
...
...
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
View file @
62ea2bbc
...
...
@@ -47,6 +47,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
m_pCurFileWriter
=
NULL
;
m_bIsNoBase64Save
=
false
;
m_bIsNoBase64
=
false
;
m_bSaveChartAsImg
=
false
;
}
BinDocxRW
::
CDocxSerializer
::~
CDocxSerializer
()
...
...
@@ -54,52 +55,6 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
RELEASEOBJECT
(
m_pParamsWriter
);
RELEASEOBJECT
(
m_pCurFileWriter
);
}
bool
BinDocxRW
::
CDocxSerializer
::
ConvertDocxToDoct
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstFileName
,
const
std
::
wstring
&
sTmpDir
,
const
std
::
wstring
&
sXMLOptions
)
{
std
::
wstring
strDirSrc
=
NSSystemPath
::
Combine
(
sTmpDir
,
L"from"
);
std
::
wstring
strDirDst
=
NSSystemPath
::
Combine
(
sTmpDir
,
L"to"
);
std
::
wstring
strEditorBin
=
NSSystemPath
::
Combine
(
strDirDst
,
L"Editor.bin"
);
NSDirectory
::
CreateDirectory
(
strDirSrc
);
NSDirectory
::
CreateDirectory
(
strDirDst
);
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sSrcFileName
,
strDirSrc
,
NULL
,
0
))
if
(
saveToFile
(
strEditorBin
,
strDirSrc
,
sXMLOptions
))
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
))
return
true
;
return
false
;
}
bool
BinDocxRW
::
CDocxSerializer
::
ConvertDoctToDocx
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstFileName
,
const
std
::
wstring
&
sTmpDir
,
const
std
::
wstring
&
sXMLOptions
)
{
std
::
wstring
strDirSrc
=
NSSystemPath
::
Combine
(
sTmpDir
,
L"from"
);
std
::
wstring
strEditorBin
=
NSSystemPath
::
Combine
(
strDirSrc
,
L"Editor.bin"
);
std
::
wstring
strDirDst
=
NSSystemPath
::
Combine
(
sTmpDir
,
L"to"
);
NSDirectory
::
CreateDirectory
(
strDirSrc
);
NSDirectory
::
CreateDirectory
(
strDirDst
);
std
::
wstring
sEditorBin
=
strEditorBin
;
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sSrcFileName
,
strDirSrc
,
NULL
,
0
))
{
std
::
wstring
sMediaPath
;
std
::
wstring
sThemePath
;
std
::
wstring
sEmbedPath
;
CreateDocxFolders
(
strDirDst
,
sThemePath
,
sMediaPath
,
sEmbedPath
);
if
(
loadFromFile
(
sEditorBin
,
strDirDst
,
sXMLOptions
,
sThemePath
,
sMediaPath
,
sEmbedPath
))
{
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
,
true
))
return
true
;
}
}
return
false
;
}
bool
BinDocxRW
::
CDocxSerializer
::
saveToFile
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstPath
,
const
std
::
wstring
&
sXMLOptions
)
{
OOX
::
CPath
pathMain
(
sSrcFileName
);
...
...
@@ -144,13 +99,17 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
BinaryFileWriter
oBinaryFileWriter
(
*
m_pParamsWriter
);
if
(
m_bIsNoBase64
)
{
oBufferedStream
.
WriteStringUtf8
(
oBinaryFileWriter
.
WriteFileHeader
(
0
,
g_nFormatVersionNoBase64
));
}
oBinaryFileWriter
.
intoBindoc
(
sDstPath
);
BYTE
*
pbBinBuffer
=
oBufferedStream
.
GetBuffer
();
int
nBinBufferLen
=
oBufferedStream
.
GetPosition
();
if
(
m_bIsNoBase64Save
)
if
(
m_bIsNoBase64
||
m_bIsNoBase64Save
)
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
sSrcFileName
);
...
...
@@ -166,7 +125,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
sSrcFileName
);
oFile
.
WriteStringUTF8
(
oBinaryFileWriter
.
WriteFileHeader
(
nBinBufferLen
));
oFile
.
WriteStringUTF8
(
oBinaryFileWriter
.
WriteFileHeader
(
nBinBufferLen
,
g_nFormatVersion
));
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
oFile
.
CloseFile
();
}
...
...
@@ -268,27 +227,42 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
else
dst_len
+=
_c
;
}
int
nDataSize
=
atoi
(
dst_len
.
c_str
());
BYTE
*
pData
=
new
BYTE
[
nDataSize
];
if
(
false
!=
Base64
::
Base64Decode
((
const
char
*
)(
pBase64Data
+
nIndex
),
nBase64DataSize
-
nIndex
,
pData
,
&
nDataSize
))
int
nVersion
=
g_nFormatVersion
;
if
(
!
version
.
empty
())
{
NSBinPptxRW
::
CDrawingConverter
oDrawingConverter
;
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
=
*
oDrawingConverter
.
m_pReader
;
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
)
;
version
=
version
.
substr
(
1
)
;
g_nCurFormatVersion
=
nVersion
=
std
::
stoi
(
version
.
c_str
());
}
bool
bIsNoBase64
=
nVersion
==
g_nFormatVersionNoBase64
;
int
nVersion
=
g_nFormatVersion
;
if
(
!
version
.
empty
())
NSBinPptxRW
::
CDrawingConverter
oDrawingConverter
;
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
=
*
oDrawingConverter
.
m_pReader
;
int
nDataSize
=
0
;
BYTE
*
pData
=
NULL
;
if
(
!
bIsNoBase64
)
{
nDataSize
=
atoi
(
dst_len
.
c_str
());
pData
=
new
BYTE
[
nDataSize
];
if
(
Base64
::
Base64Decode
((
const
char
*
)(
pBase64Data
+
nIndex
),
nBase64DataSize
-
nIndex
,
pData
,
&
nDataSize
))
{
version
=
version
.
substr
(
1
);
int
nTempVersion
=
atoi
(
version
.
c_str
());
if
(
0
!=
nTempVersion
)
{
g_nCurFormatVersion
=
nVersion
=
nTempVersion
;
}
}
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
);
}
else
{
RELEASEARRAYOBJECTS
(
pData
);
}
}
else
{
nDataSize
=
nBase64DataSize
;
pData
=
pBase64Data
;
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
);
oBufferedStream
.
Seek
(
nIndex
);
}
if
(
NULL
!=
pData
)
{
oDrawingConverter
.
SetMainDocument
(
this
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaPath
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedPath
);
...
...
@@ -343,6 +317,11 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
bResultOk
=
true
;
}
if
(
!
bIsNoBase64
)
{
RELEASEARRAYOBJECTS
(
pData
);
}
}
RELEASEARRAYOBJECTS
(
pBase64Data
);
}
...
...
@@ -472,6 +451,10 @@ void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool bIsNoBase64Save)
{
m_bIsNoBase64Save
=
bIsNoBase64Save
;
}
void
BinDocxRW
::
CDocxSerializer
::
setIsNoBase64
(
bool
bIsNoBase64
)
{
m_bIsNoBase64
=
bIsNoBase64
;
}
void
BinDocxRW
::
CDocxSerializer
::
setSaveChartAsImg
(
bool
bSaveChartAsImg
)
{
m_bSaveChartAsImg
=
bSaveChartAsImg
;
...
...
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
View file @
62ea2bbc
...
...
@@ -54,6 +54,7 @@ namespace BinDocxRW
std
::
wstring
m_sFontDir
;
std
::
wstring
m_sEmbeddedFontsDir
;
bool
m_bIsNoBase64Save
;
bool
m_bIsNoBase64
;
bool
m_bSaveChartAsImg
;
ParamsWriter
*
m_pParamsWriter
;
Writers
::
FileWriter
*
m_pCurFileWriter
;
...
...
@@ -61,9 +62,6 @@ namespace BinDocxRW
CDocxSerializer
();
virtual
~
CDocxSerializer
();
bool
ConvertDocxToDoct
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstFileName
,
const
std
::
wstring
&
sTmpDir
,
const
std
::
wstring
&
sXMLOptions
);
bool
ConvertDoctToDocx
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstFileName
,
const
std
::
wstring
&
sTmpDir
,
const
std
::
wstring
&
sXMLOptions
);
bool
loadFromFile
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstPath
,
const
std
::
wstring
&
sXMLOptions
,
const
std
::
wstring
&
sThemePath
,
const
std
::
wstring
&
sMediaPath
,
const
std
::
wstring
&
sEmbedPath
);
bool
saveToFile
(
const
std
::
wstring
&
sSrcFileName
,
const
std
::
wstring
&
sDstPath
,
const
std
::
wstring
&
sXMLOptions
);
...
...
@@ -78,6 +76,7 @@ namespace BinDocxRW
void
setFontDir
(
const
std
::
wstring
&
sFontDir
);
void
setEmbeddedFontsDir
(
const
std
::
wstring
&
sEmbeddedFontsDir
);
void
setIsNoBase64Save
(
bool
bIsNoBase64Save
);
void
setIsNoBase64
(
bool
bIsNoBase64
);
void
setSaveChartAsImg
(
bool
bSaveChartAsImg
);
};
}
...
...
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
View file @
62ea2bbc
...
...
@@ -49,6 +49,7 @@ namespace BinXlsxRW{
CXlsxSerializer
::
CXlsxSerializer
()
{
m_pExternalDrawingConverter
=
NULL
;
m_bIsNoBase64
=
false
;
}
CXlsxSerializer
::~
CXlsxSerializer
()
{
...
...
@@ -134,7 +135,7 @@ namespace BinXlsxRW{
oOfficeDrawingConverter
.
SetFontPicker
(
pFontPicker
);
BinXlsxRW
::
BinaryFileWriter
oBinaryFileWriter
(
fp
);
oBinaryFileWriter
.
Open
(
sSrcPath
,
sDstFileName
,
pEmbeddedFontsManager
,
&
oOfficeDrawingConverter
,
sXMLOptions
);
oBinaryFileWriter
.
Open
(
sSrcPath
,
sDstFileName
,
pEmbeddedFontsManager
,
&
oOfficeDrawingConverter
,
sXMLOptions
,
m_bIsNoBase64
);
RELEASEOBJECT
(
pFontPicker
);
return
true
;
...
...
@@ -226,6 +227,11 @@ namespace BinXlsxRW{
{
m_pExternalDrawingConverter
=
pDrawingConverter
;
}
void
CXlsxSerializer
::
setIsNoBase64
(
bool
bIsNoBase64
)
{
m_bIsNoBase64
=
bIsNoBase64
;
}
void
CXlsxSerializer
::
writeChartXlsx
(
const
std
::
wstring
&
sDstFile
,
const
OOX
::
Spreadsheet
::
CChartSpace
&
oChart
)
{
//анализируем chart
...
...
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
View file @
62ea2bbc
...
...
@@ -55,6 +55,7 @@ namespace BinXlsxRW {
std
::
wstring
m_sFontDir
;
std
::
wstring
m_sEmbeddedFontsDir
;
NSBinPptxRW
::
CDrawingConverter
*
m_pExternalDrawingConverter
;
bool
m_bIsNoBase64
;
public:
CXlsxSerializer
();
~
CXlsxSerializer
();
...
...
@@ -69,6 +70,7 @@ namespace BinXlsxRW {
void
setFontDir
(
const
std
::
wstring
&
sFontDir
);
void
setEmbeddedFontsDir
(
const
std
::
wstring
&
sEmbeddedFontsDir
);
void
setDrawingConverter
(
NSBinPptxRW
::
CDrawingConverter
*
pDrawingConverter
);
void
setIsNoBase64
(
bool
bIsNoBase64
);
void
writeChartXlsx
(
const
std
::
wstring
&
sDstFile
,
const
OOX
::
Spreadsheet
::
CChartSpace
&
oChart
);
};
...
...
ASCOfficePPTXFile/ASCOfficePPTXFile.h
View file @
62ea2bbc
...
...
@@ -61,6 +61,7 @@ private:
std
::
wstring
m_strEmbeddedFontsDirectory
;
std
::
wstring
m_strFolderThemes
;
bool
m_bIsNoBase64
;
extract_to_directory
m_fCallbackExtract
;
compress_from_directory
m_fCallbackCompress
;
...
...
@@ -93,6 +94,7 @@ public:
HRESULT
SetFontDir
(
std
::
wstring
bsFontDir
);
HRESULT
SetThemesDir
(
std
::
wstring
bsDir
);
HRESULT
SetUseSystemFonts
(
bool
useSystemFonts
);
void
SetIsNoBase64
(
bool
bIsNoBase64
);
HRESULT
OpenFileToPPTY
(
std
::
wstring
bsInput
,
std
::
wstring
bsOutput
);
HRESULT
OpenDirectoryToPPTY
(
std
::
wstring
bsInput
,
std
::
wstring
bsOutput
);
HRESULT
ConvertPPTYToPPTX
(
std
::
wstring
bsInput
,
std
::
wstring
bsOutput
,
std
::
wstring
bsThemesFolder
);
...
...
ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp
View file @
62ea2bbc
...
...
@@ -67,6 +67,7 @@ CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_direct
m_strEmbeddedFontsDirectory
=
_T
(
""
);
m_strFolderThemes
=
_T
(
""
);
m_bIsNoBase64
=
false
;
//m_fCallbackResource = fCallbackResource;
m_fCallbackExtract
=
fCallbackExtract
;
...
...
@@ -232,6 +233,10 @@ HRESULT CPPTXFile::SetUseSystemFonts(bool val)
m_bIsUseSystemFonts
=
val
;
return
S_OK
;
}
void
CPPTXFile
::
SetIsNoBase64
(
bool
bIsNoBase64
)
{
m_bIsNoBase64
=
bIsNoBase64
;
}
HRESULT
CPPTXFile
::
OpenFileToPPTY
(
std
::
wstring
bsInput
,
std
::
wstring
bsOutput
)
{
if
(
m_strTempDir
.
empty
())
...
...
@@ -325,7 +330,7 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
}
}
PPTX2EditorAdvanced
::
Convert
(
oBinaryWriter
,
*
m_pFolder
,
m_strDirectory
,
pathDstFileOutput
.
GetPath
());
PPTX2EditorAdvanced
::
Convert
(
oBinaryWriter
,
*
m_pFolder
,
m_strDirectory
,
pathDstFileOutput
.
GetPath
()
,
m_bIsNoBase64
);
return
S_OK
;
}
...
...
@@ -360,7 +365,7 @@ HRESULT CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput
std
::
wstring
strBsInput
=
bsInput
;
std
::
wstring
srcFolder
=
NSDirectory
::
GetFolderPath
(
strBsInput
);
oWriter
.
OpenPPTY
(
pSrcBuffer
,
lFileSize
,
srcFolder
,
bsThemesFolder
);
oWriter
.
OpenPPTY
(
pSrcBuffer
,
lFileSize
,
srcFolder
,
bsThemesFolder
);
RELEASEARRAYOBJECTS
(
pSrcBuffer
);
HRESULT
hRes
=
S_OK
;
...
...
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
View file @
62ea2bbc
...
...
@@ -42,6 +42,8 @@ namespace NSBinPptxRW
const
BYTE
g_nodeAttributeStart
=
0xFA
;
const
BYTE
g_nodeAttributeEnd
=
0xFB
;
const
int
g_nFormatVersionNoBase64
=
10
;
namespace
NSSerFormat
{
enum
SerFormat
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
62ea2bbc
...
...
@@ -790,6 +790,17 @@ namespace NSBinPptxRW
{
_WriteString
(
sBuffer
.
c_str
(),
(
_UINT32
)
sBuffer
.
length
());
}
void
CBinaryFileWriter
::
WriteStringUtf8
(
const
std
::
wstring
&
sBuffer
)
{
BYTE
*
pData
=
NULL
;
LONG
lLen
=
0
;
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sBuffer
.
c_str
(),
(
LONG
)
sBuffer
.
length
(),
pData
,
lLen
,
false
);
WriteBYTEArray
(
pData
,
lLen
);
RELEASEARRAYOBJECTS
(
pData
);
}
CBinaryFileWriter
::
CBinaryFileWriter
()
{
m_pMainDocument
=
NULL
;
...
...
@@ -844,9 +855,9 @@ namespace NSBinPptxRW
m_lPosition
+=
(
_UINT32
)
lCount
;
}
void
CBinaryFileWriter
::
WriteMainPart
()
void
CBinaryFileWriter
::
WriteMainPart
(
_UINT32
nStartPos
)
{
BYTE
*
pData
=
m_pStreamData
;
BYTE
*
pData
=
m_pStreamData
+
nStartPos
;
size_t
nCount
=
m_arMainTables
.
size
();
for
(
size_t
i
=
0
;
i
<
nCount
;
i
++
)
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
View file @
62ea2bbc
...
...
@@ -292,6 +292,7 @@ namespace NSBinPptxRW
void
WriteStringW3
(
const
std
::
wstring
&
sBuffer
);
void
WriteStringW4
(
const
std
::
wstring
&
sBuffer
);
void
WriteStringUtf8
(
const
std
::
wstring
&
sBuffer
);
// --------------------------------------------------------
void
WriteLONG64
(
const
_INT64
&
lValue
);
void
WriteDouble64
(
const
double
&
dValue
);
...
...
@@ -306,7 +307,7 @@ namespace NSBinPptxRW
void
StartMainRecord
(
_INT32
lType
);
void
WriteReserved
(
size_t
lCount
);
void
WriteMainPart
();
void
WriteMainPart
(
_UINT32
nStartPos
);
void
WriteString1
(
int
type
,
const
std
::
wstring
&
val
);
void
WriteString2
(
int
type
,
const
NSCommon
::
nullable_string
&
val
);
...
...
ASCOfficePPTXFile/Editor/Converter.h
View file @
62ea2bbc
...
...
@@ -38,7 +38,7 @@ namespace PPTX2EditorAdvanced
{
using
namespace
NSBinPptxRW
;
DWORD
Convert
(
NSBinPptxRW
::
CBinaryFileWriter
&
oBinaryWriter
,
PPTX
::
Folder
&
oFolder
,
const
std
::
wstring
&
strSourceDirectory
,
const
std
::
wstring
&
strDstFile
)
DWORD
Convert
(
NSBinPptxRW
::
CBinaryFileWriter
&
oBinaryWriter
,
PPTX
::
Folder
&
oFolder
,
const
std
::
wstring
&
strSourceDirectory
,
const
std
::
wstring
&
strDstFile
,
bool
bIsNoBase64
)
{
// сначала соберем все объекты для конвертации и сформируем main-таблицы
NSBinPptxRW
::
CCommonWriter
*
pCommon
=
oBinaryWriter
.
m_pCommon
;
...
...
@@ -230,6 +230,12 @@ namespace PPTX2EditorAdvanced
oBinaryWriter
.
m_pCommon
->
m_oNote_Rels
.
push_back
(
nMasterIndex
);
}
if
(
bIsNoBase64
)
{
std
::
wstring
strPrefix
=
L"PPTY;v"
+
std
::
to_wstring
(
g_nFormatVersionNoBase64
)
+
L";0;"
;
oBinaryWriter
.
WriteStringUtf8
(
strPrefix
);
}
_UINT32
nStartPos
=
oBinaryWriter
.
GetPosition
();
// нужно записать все в maintables. А кроме главных таблиц ничего и нету. Все остальное лежит в них
// на каждую таблицу - 5 байт (тип и сдвиг)
// число таблиц - заранее известно (сделаем 30. если потом не будет хватать - новая версия формата)
...
...
@@ -516,29 +522,35 @@ namespace PPTX2EditorAdvanced
// ------------------------------------------------
oBinaryWriter
.
WriteEmbeddedFonts
();
oBinaryWriter
.
WriteMainPart
();
oBinaryWriter
.
WriteMainPart
(
nStartPos
);
// все записалось нормально. осталось скинуть на диск
BYTE
*
pbBinBuffer
=
oBinaryWriter
.
GetBuffer
();
int
nBinBufferLen
=
(
int
)
oBinaryWriter
.
GetPosition
();
int
nBase64BufferLen
=
Base64
::
Base64EncodeGetRequiredLength
(
nBinBufferLen
,
Base64
::
B64_BASE64_FLAG_NOCRLF
);
BYTE
*
pbBase64Buffer
=
new
BYTE
[
nBase64BufferLen
+
64
];
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
if
(
true
==
Base64_1
::
Base64Encode
(
pbBinBuffer
,
nBinBufferLen
,
pbBase64Buffer
,
&
nBase64BufferLen
))
{
CFile
oFile
;
#if defined(_WIN32) || defined (_WIN64)
oFile
.
CreateFileW
(
strDstFile
);
#else
oFile
.
CreateFile
(
strDstFile
);
#endif
std
::
string
strPrefix
=
"PPTY;v1;"
+
std
::
to_string
(
nBinBufferLen
)
+
";"
;
oFile
.
WriteFile
((
void
*
)
strPrefix
.
c_str
(),
(
DWORD
)
strPrefix
.
length
());
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
if
(
bIsNoBase64
)
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
strDstFile
);
oFile
.
WriteFile
(
pbBinBuffer
,
nBinBufferLen
);
oFile
.
CloseFile
();
}
else
{
int
nBase64BufferLen
=
Base64
::
Base64EncodeGetRequiredLength
(
nBinBufferLen
,
Base64
::
B64_BASE64_FLAG_NOCRLF
);
BYTE
*
pbBase64Buffer
=
new
BYTE
[
nBase64BufferLen
+
64
];
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
if
(
true
==
Base64_1
::
Base64Encode
(
pbBinBuffer
,
nBinBufferLen
,
pbBase64Buffer
,
&
nBase64BufferLen
))
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
strDstFile
);
std
::
wstring
strPrefix
=
L"PPTY;v1;"
+
std
::
to_wstring
(
nBinBufferLen
)
+
L";"
;
oFile
.
WriteStringUTF8
(
strPrefix
);
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
oFile
.
CloseFile
();
}
RELEASEARRAYOBJECTS
(
pbBase64Buffer
);
RELEASEARRAYOBJECTS
(
pbBase64Buffer
);
}
return
0
;
}
}
ASCOfficePPTXFile/Editor/PPTXWriter.h
View file @
62ea2bbc
...
...
@@ -118,7 +118,7 @@ namespace NSBinPptxRW
m_oReader
.
m_strFolderThemes
=
pathTheme
.
GetPath
();
}
void
OpenPPTY
(
BYTE
*
pBuffer
,
int
len
,
std
::
wstring
srcFolder
,
std
::
wstring
strThemesFolder
)
void
OpenPPTY
(
BYTE
*
pBuffer
,
int
len
,
std
::
wstring
srcFolder
,
std
::
wstring
strThemesFolder
)
{
int
start_pos
=
0
;
...
...
@@ -158,11 +158,30 @@ namespace NSBinPptxRW
int
dstLenTemp
=
XmlUtils
::
GetInteger
(
__str_decode_len
);
//int dstLenTemp = Base64DecodeGetRequiredLength(len);
BYTE
*
pDstBuffer
=
new
BYTE
[
dstLenTemp
];
int
dstLen
=
dstLenTemp
;
Base64
::
Base64Decode
((
const
char
*
)
pBuffer
,
len
,
pDstBuffer
,
&
dstLen
);
int
nVersion
=
1
;
if
(
__str_version
.
length
()
>
1
)
{
nVersion
=
std
::
stoi
(
__str_version
.
substr
(
1
).
c_str
());
}
bool
bIsNoBase64
=
nVersion
==
g_nFormatVersionNoBase64
;
BYTE
*
pDstBuffer
=
NULL
;
int
dstLen
=
0
;
if
(
!
bIsNoBase64
)
{
BYTE
*
pDstBuffer
=
new
BYTE
[
dstLenTemp
];
int
dstLen
=
dstLenTemp
;
Base64
::
Base64Decode
((
const
char
*
)
pBuffer
,
len
,
pDstBuffer
,
&
dstLen
);
m_oReader
.
Init
(
pDstBuffer
,
0
,
dstLen
);
}
else
{
pDstBuffer
=
pBuffer
-
start_pos
;
dstLen
=
len
+
start_pos
;
m_oReader
.
Init
(
pDstBuffer
,
0
,
dstLen
);
m_oReader
.
Seek
(
start_pos
);
}
m_oReader
.
Init
(
pDstBuffer
,
0
,
dstLen
);
m_oReader
.
m_strFolder
=
srcFolder
;
m_oReader
.
m_strFolderExternalThemes
=
strThemesFolder
;
...
...
@@ -813,8 +832,10 @@ namespace NSBinPptxRW
bIsAuthors
=
true
;
}
}
RELEASEARRAYOBJECTS
(
pDstBuffer
);
if
(
!
bIsNoBase64
)
{
RELEASEARRAYOBJECTS
(
pDstBuffer
);
}
// content types
OOX
::
CContentTypes
*
pContentTypes
=
m_oImageManager
.
m_pContentTypes
;
...
...
X2tConverter/src/ASCConverters.cpp
View file @
62ea2bbc
...
...
@@ -128,6 +128,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
m_oCDocxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCDocxSerializer
.
setFontDir
(
params
.
getFontPath
());
//bool bRes = m_oCDocxSerializer.saveToFile (sResDoct, sSrcDocx, sTemp);
...
...
@@ -188,7 +189,8 @@ namespace NExtractTools
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
m_oCDocxSerializer
.
setFontDir
(
params
.
getFontPath
());
m_oCDocxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCDocxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sXmlOptions
=
_T
(
""
);
std
::
wstring
sThemePath
;
// will be filled by 'CreateDocxFolders' method
...
...
@@ -255,6 +257,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
return
m_oCXlsxSerializer
.
saveToFile
(
sTo
,
sXlsxDir
,
bXmlOptions
?
params
.
getXmlOptions
()
:
L""
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
...
...
@@ -309,7 +312,8 @@ namespace NExtractTools
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sXmlOptions
=
_T
(
""
);
std
::
wstring
sMediaPath
;
// will be filled by 'CreateXlsxFolders' method
...
...
@@ -377,6 +381,7 @@ namespace NExtractTools
if
(
pptx_file
)
{
pptx_file
->
SetIsNoBase64
(
params
.
getIsNoBase64
());
pptx_file
->
put_TempDirectory
(
sTemp
);
pptx_file
->
SetFontDir
(
params
.
getFontPath
());
nRes
=
(
S_OK
==
pptx_file
->
OpenFileToPPTY
(
sFrom
,
sTo
))
?
nRes
:
AVS_FILEUTILS_ERROR_CONVERT
;
...
...
@@ -438,6 +443,7 @@ namespace NExtractTools
if
(
pptx_file
)
{
pptx_file
->
SetIsNoBase64
(
params
.
getIsNoBase64
());
pptx_file
->
SetFontDir
(
params
.
getFontPath
());
nRes
=
(
S_OK
==
pptx_file
->
ConvertPPTYToPPTX
(
sTargetBin
,
sTo
,
sThemeDir
))
?
nRes
:
AVS_FILEUTILS_ERROR_CONVERT
;
...
...
@@ -492,7 +498,8 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
int
nRes
=
m_oCXlsxSerializer
.
saveToFile
(
sResultXlstFileEditor
,
sCSV
,
params
.
getXmlOptions
())
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
if
(
SUCCEEDED_X2T
(
nRes
))
...
...
@@ -517,6 +524,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
COfficeUtils
oCOfficeUtils
(
NULL
);
...
...
@@ -541,6 +549,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
return
m_oCXlsxSerializer
.
saveToFile
(
sTo
,
sFrom
,
params
.
getXmlOptions
())
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
...
...
@@ -562,6 +571,7 @@ namespace NExtractTools
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sMediaPath
;
...
...
@@ -587,6 +597,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sXMLOptions
=
_T
(
""
);
...
...
@@ -617,6 +628,7 @@ namespace NExtractTools
// Save to file (from temp dir)
BinXlsxRW
::
CXlsxSerializer
m_oCXlsxSerializer
;
m_oCXlsxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCXlsxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sToTemp
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"output.csv"
);
...
...
@@ -645,7 +657,14 @@ namespace NExtractTools
pdfWriter
.
SetTempFolder
(
sTemp
);
pdfWriter
.
SetThemesPlace
(
sThemeDir
);
int
nReg
=
(
bPaid
==
false
)
?
0
:
1
;
return
S_OK
==
pdfWriter
.
OnlineWordToPdf
(
sFrom
,
sTo
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
if
(
params
.
getIsNoBase64
())
{
return
S_OK
==
pdfWriter
.
OnlineWordToPdfFromBinary
(
sFrom
,
sTo
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
else
{
return
S_OK
==
pdfWriter
.
OnlineWordToPdf
(
sFrom
,
sTo
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
int
bin2image
(
const
std
::
wstring
&
sTFileDir
,
BYTE
*
pBuffer
,
LONG
lBufferLen
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sThemeDir
,
InputParams
&
params
)
{
...
...
@@ -1713,8 +1732,8 @@ namespace NExtractTools
std
::
wstring
sTempDocx
=
sTemp
+
FILE_SEPARATOR_STR
+
wsFilePathInFilename
+
L"_DOCX"
;
NSDirectory
::
CreateDirectory
(
sTempDocx
);
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
m_oCDocxSerializer
.
setIsNoBase64
(
params
.
getIsNoBase64
());
m_oCDocxSerializer
.
setFontDir
(
params
.
getFontPath
());
std
::
wstring
sXmlOptions
;
...
...
X2tConverter/src/cextracttools.h
View file @
62ea2bbc
...
...
@@ -358,6 +358,7 @@ namespace NExtractTools
std
::
wstring
*
m_sHtmlFileInternalPath
;
std
::
wstring
*
m_sPassword
;
std
::
wstring
*
m_sTempDir
;
bool
*
m_bIsNoBase64
;
//output params
mutable
bool
m_bOutputConvertCorrupted
;
public:
...
...
@@ -383,6 +384,7 @@ namespace NExtractTools
m_sHtmlFileInternalPath
=
NULL
;
m_sPassword
=
NULL
;
m_sTempDir
=
NULL
;
m_bIsNoBase64
=
NULL
;
m_bOutputConvertCorrupted
=
false
;
}
...
...
@@ -408,6 +410,7 @@ namespace NExtractTools
RELEASEOBJECT
(
m_sHtmlFileInternalPath
);
RELEASEOBJECT
(
m_sPassword
);
RELEASEOBJECT
(
m_sTempDir
);
RELEASEOBJECT
(
m_bIsNoBase64
);
}
bool
FromXmlFile
(
const
std
::
wstring
&
sFilename
)
...
...
@@ -496,6 +499,8 @@ namespace NExtractTools
m_sPassword
=
new
std
::
wstring
(
sValue
);
else
if
(
_T
(
"m_sTempDir"
)
==
sName
)
m_sTempDir
=
new
std
::
wstring
(
sValue
);
else
if
(
_T
(
"m_bIsNoBase64"
)
==
sName
)
m_bIsNoBase64
=
new
bool
(
XmlUtils
::
GetBoolean2
(
sValue
));
}
else
if
(
_T
(
"m_nCsvDelimiterChar"
)
==
sName
)
{
...
...
@@ -523,6 +528,10 @@ namespace NExtractTools
{
return
(
NULL
!=
m_sFontDir
)
?
(
*
m_sFontDir
)
:
L""
;
}
bool
getIsNoBase64
()
const
{
return
(
NULL
!=
m_bIsNoBase64
)
?
(
*
m_bIsNoBase64
)
:
false
;
}
std
::
wstring
getXmlOptions
()
{
std
::
wstring
sRes
;
...
...
XlsxSerializerCom/Common/BinReaderWriterDefines.h
View file @
62ea2bbc
...
...
@@ -41,6 +41,7 @@ namespace BinXlsxRW
const
static
wchar_t
*
g_sFormatSignature
=
L"XLSY"
;
const
int
g_nFormatVersion
=
2
;
const
int
g_nFormatVersionNoBase64
=
10
;
extern
int
g_nCurFormatVersion
;
namespace
c_oFileTypes
{
enum
c_oFileTypes
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
62ea2bbc
...
...
@@ -4244,7 +4244,7 @@ namespace BinXlsxRW
RELEASEOBJECT
(
m_oBcw
);
}
void
Open
(
const
std
::
wstring
&
sInputDir
,
const
std
::
wstring
&
sFileDst
,
NSFontCutter
::
CEmbeddedFontsManager
*
pEmbeddedFontsManager
,
NSBinPptxRW
::
CDrawingConverter
*
pOfficeDrawingConverter
,
const
std
::
wstring
&
sXMLOptions
)
NSBinPptxRW
::
CDrawingConverter
*
pOfficeDrawingConverter
,
const
std
::
wstring
&
sXMLOptions
,
bool
bIsNoBase64
)
{
OOX
::
CPath
path
(
sFileDst
);
//создаем папку для media
...
...
@@ -4286,21 +4286,35 @@ namespace BinXlsxRW
}
else
{
if
(
bIsNoBase64
)
{
oBufferedStream
.
WriteStringUtf8
(
WriteFileHeader
(
0
,
g_nFormatVersionNoBase64
));
}
intoBindoc
(
*
pXlsx
,
oBufferedStream
,
pEmbeddedFontsManager
,
pOfficeDrawingConverter
);
BYTE
*
pbBinBuffer
=
oBufferedStream
.
GetBuffer
();
int
nBinBufferLen
=
oBufferedStream
.
GetPosition
();
int
nBase64BufferLen
=
Base64
::
Base64EncodeGetRequiredLength
(
nBinBufferLen
,
Base64
::
B64_BASE64_FLAG_NOCRLF
);
BYTE
*
pbBase64Buffer
=
new
BYTE
[
nBase64BufferLen
+
64
];
if
(
true
==
Base64_1
::
Base64Encode
(
pbBinBuffer
,
nBinBufferLen
,
pbBase64Buffer
,
&
nBase64BufferLen
))
if
(
bIsNoBase64
)
{
CFile
oFile
;
oFile
.
CreateFile
(
sFileDst
);
oFile
.
WriteStringUTF8
(
WriteFileHeader
(
nBinBufferLen
));
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
sFileDst
);
oFile
.
WriteFile
(
pbBinBuffer
,
nBinBufferLen
);
oFile
.
CloseFile
();
}
RELEASEARRAYOBJECTS
(
pbBase64Buffer
);
else
{
int
nBase64BufferLen
=
Base64
::
Base64EncodeGetRequiredLength
(
nBinBufferLen
,
Base64
::
B64_BASE64_FLAG_NOCRLF
);
BYTE
*
pbBase64Buffer
=
new
BYTE
[
nBase64BufferLen
+
64
];
if
(
true
==
Base64_1
::
Base64Encode
(
pbBinBuffer
,
nBinBufferLen
,
pbBase64Buffer
,
&
nBase64BufferLen
))
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
sFileDst
);
oFile
.
WriteStringUTF8
(
WriteFileHeader
(
nBinBufferLen
,
g_nFormatVersion
));
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
oFile
.
CloseFile
();
}
RELEASEARRAYOBJECTS
(
pbBase64Buffer
);
}
}
RELEASEOBJECT
(
pXlsx
);
...
...
@@ -4368,9 +4382,9 @@ namespace BinXlsxRW
WriteMainTableEnd
();
}
private:
std
::
wstring
WriteFileHeader
(
int
nDataSize
)
std
::
wstring
WriteFileHeader
(
int
nDataSize
,
int
version
)
{
std
::
wstring
sHeader
=
std
::
wstring
(
g_sFormatSignature
)
+
L";v"
+
std
::
to_wstring
(
g_nFormatV
ersion
)
+
L";"
+
std
::
to_wstring
(
nDataSize
)
+
L";"
;
std
::
wstring
sHeader
=
std
::
wstring
(
g_sFormatSignature
)
+
L";v"
+
std
::
to_wstring
(
v
ersion
)
+
L";"
+
std
::
to_wstring
(
nDataSize
)
+
L";"
;
return
sHeader
;
}
void
WriteMainTableStart
()
...
...
XlsxSerializerCom/Writer/BinaryReader.h
View file @
62ea2bbc
...
...
@@ -4262,25 +4262,41 @@ namespace BinXlsxRW {
else
dst_len
+=
_c
;
}
int
nDataSize
=
atoi
(
dst_len
.
c_str
());
BYTE
*
pData
=
new
BYTE
[
nDataSize
];
if
(
false
!=
Base64
::
Base64Decode
((
const
char
*
)(
pBase64Data
+
nIndex
),
nBase64DataSize
-
nIndex
,
pData
,
&
nDataSize
))
int
nVersion
=
g_nFormatVersion
;
if
(
!
version
.
empty
())
{
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
=
*
pOfficeDrawingConverter
->
m_pReader
;
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
);
version
=
version
.
substr
(
1
);
g_nCurFormatVersion
=
nVersion
=
std
::
stoi
(
version
.
c_str
());
}
bool
bIsNoBase64
=
nVersion
==
g_nFormatVersionNoBase64
;
int
nVersion
=
g_nFormatVersion
;
if
(
version
.
length
()
>
0
)
{
version
=
version
.
substr
(
1
);
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
=
*
pOfficeDrawingConverter
->
m_pReader
;
int
nTempVersion
=
atoi
(
version
.
c_str
());
if
(
0
!=
nTempVersion
)
{
g_nCurFormatVersion
=
nVersion
=
nTempVersion
;
}
int
nDataSize
=
0
;
BYTE
*
pData
=
NULL
;
if
(
!
bIsNoBase64
)
{
nDataSize
=
atoi
(
dst_len
.
c_str
());
pData
=
new
BYTE
[
nDataSize
];
if
(
Base64
::
Base64Decode
((
const
char
*
)(
pBase64Data
+
nIndex
),
nBase64DataSize
-
nIndex
,
pData
,
&
nDataSize
))
{
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
);
}
else
{
RELEASEARRAYOBJECTS
(
pData
);
}
}
else
{
nDataSize
=
nBase64DataSize
;
pData
=
pBase64Data
;
oBufferedStream
.
Init
(
pData
,
0
,
nDataSize
);
oBufferedStream
.
Seek
(
nIndex
);
}
if
(
NULL
!=
pData
)
{
// File Type
std
::
wstring
sDstPathCSV
=
sDstPath
;
BYTE
fileType
;
...
...
@@ -4321,7 +4337,13 @@ namespace BinXlsxRW {
}
bResultOk
=
true
;
}
if
(
!
bIsNoBase64
)
{
RELEASEARRAYOBJECTS
(
pData
);
}
}
RELEASEARRAYOBJECTS
(
pBase64Data
);
}
return
S_OK
;
}
...
...
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