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
af81688a
Commit
af81688a
authored
May 03, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormat - правка багов (файлы с com-сервера)
parent
e5f9ea50
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
168 additions
and
20 deletions
+168
-20
ASCOfficeXlsFile2/ASCOfficeXlsFileTest/ASCOfficeXlsFileTest.cpp
...iceXlsFile2/ASCOfficeXlsFileTest/ASCOfficeXlsFileTest.cpp
+7
-7
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.cpp
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.cpp
+1
-0
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.h
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.h
+1
-0
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.cpp
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.cpp
+3
-3
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
+4
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoundSheet8.cpp
...File2/source/XlsFormat/Logic/Biff_records/BoundSheet8.cpp
+6
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
...File2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
+11
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp
+81
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h
...fficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h
+26
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/AF12Criteria.h
...le2/source/XlsFormat/Logic/Biff_structures/AF12Criteria.h
+1
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AUTOFILTER_bu.cpp
...ile2/source/XlsFormat/Logic/Biff_unions/AUTOFILTER_bu.cpp
+1
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PAGESETUP.cpp
...XlsFile2/source/XlsFormat/Logic/Biff_unions/PAGESETUP.cpp
+6
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorkbookStreamObject.cpp
...eXlsFile2/source/XlsFormat/Logic/WorkbookStreamObject.cpp
+3
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
...iceXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
+15
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
...fficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
+1
-0
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
+1
-1
No files found.
ASCOfficeXlsFile2/ASCOfficeXlsFileTest/ASCOfficeXlsFileTest.cpp
View file @
af81688a
...
@@ -28,16 +28,16 @@ int _tmain(int argc, _TCHAR* argv[])
...
@@ -28,16 +28,16 @@ int _tmain(int argc, _TCHAR* argv[])
hr
=
ConvertXls2Xlsx
(
srcFileName
,
dstTempPath
,
L"password1"
,
L"C:
\\
Windows
\\
Fonts"
,
NULL
);
hr
=
ConvertXls2Xlsx
(
srcFileName
,
dstTempPath
,
L"password1"
,
L"C:
\\
Windows
\\
Fonts"
,
NULL
);
if
(
hr
!=
S_OK
)
return
hr
;
if
(
hr
==
S_OK
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
!=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
.
c_str
(),
-
1
))
hr
=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
.
c_str
(),
-
1
);
return
hr
;
}
FileSystem
::
Directory
::
DeleteDirectory
(
dstTempPath
);
FileSystem
::
Directory
::
DeleteDirectory
(
dstTempPath
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
std
::
cout
<<
"
\n\n
Time : "
<<
t1
.
elapsed
()
<<
"
\n
"
;
std
::
cout
<<
"
\n\n
Time : "
<<
t1
.
elapsed
()
<<
"
\n
"
;
return
0
;
return
0
;
return
hr
;
}
}
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.cpp
View file @
af81688a
...
@@ -371,6 +371,7 @@ CFRecordTypeValues[] =
...
@@ -371,6 +371,7 @@ CFRecordTypeValues[] =
{
"GelFrame"
,
rt_GelFrame
},
{
"GelFrame"
,
rt_GelFrame
},
{
"BopPopCustom"
,
rt_BopPopCustom
},
{
"BopPopCustom"
,
rt_BopPopCustom
},
{
"Fbi2"
,
rt_Fbi2
},
{
"Fbi2"
,
rt_Fbi2
},
{
"CommentText"
,
rt_CommentText
},
{
"ANY_TYPE"
,
rt_ANY_TYPE
}
{
"ANY_TYPE"
,
rt_ANY_TYPE
}
};
};
...
...
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFRecordType.h
View file @
af81688a
...
@@ -230,6 +230,7 @@ typedef enum CF_RECORD_TYPE
...
@@ -230,6 +230,7 @@ typedef enum CF_RECORD_TYPE
rt_DefaultRowHeight
=
0x0225
,
rt_DefaultRowHeight
=
0x0225
,
rt_Table
=
0x0236
,
rt_Table
=
0x0236
,
rt_Window2
=
0x023e
,
rt_Window2
=
0x023e
,
rt_CommentText
=
0x027d
,
//??
rt_RK
=
0x027e
,
rt_RK
=
0x027e
,
rt_Style
=
0x0293
,
rt_Style
=
0x0293
,
rt_BigName
=
0x0418
,
rt_BigName
=
0x0418
,
...
...
ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.cpp
View file @
af81688a
...
@@ -34,13 +34,13 @@ void CFStream::read(void* buf, const size_t size)
...
@@ -34,13 +34,13 @@ void CFStream::read(void* buf, const size_t size)
{
{
if
(
NULL
==
buf
||
stream_
==
NULL
)
if
(
NULL
==
buf
||
stream_
==
NULL
)
{
{
throw
;
//
EXCEPT::RT::CompoundFileFormatError("Wrong buffer pointer (NULL)");
return
;
//throw;
EXCEPT::RT::CompoundFileFormatError("Wrong buffer pointer (NULL)");
}
}
POLE
::
uint64
num_read
=
stream_
->
read
((
unsigned
char
*
)
buf
,
size
);
POLE
::
uint64
num_read
=
stream_
->
read
((
unsigned
char
*
)
buf
,
size
);
if
(
num_read
<
size
)
if
(
num_read
<
size
)
{
{
throw
;
//
EXCEPT::RT::EndOfStreamReached(stream_->fullName(), num_read, size);
return
;
//throw;
EXCEPT::RT::EndOfStreamReached(stream_->fullName(), num_read, size);
}
}
// Tipa successful
// Tipa successful
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Binary/CompoundFile.cpp
View file @
af81688a
...
@@ -61,6 +61,10 @@ CFStreamPtr CompoundFile::getWorkbookStream()
...
@@ -61,6 +61,10 @@ CFStreamPtr CompoundFile::getWorkbookStream()
if
(
stream
==
NULL
)
if
(
stream
==
NULL
)
stream
=
getNamedStream
(
"Book"
);
stream
=
getNamedStream
(
"Book"
);
if
(
stream
==
NULL
)
stream
=
getNamedStream
(
"BOOK"
);
//file(6).xls
if
(
stream
==
NULL
)
stream
=
getNamedStream
(
"book"
);
return
stream
;
return
stream
;
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoundSheet8.cpp
View file @
af81688a
#include "BoundSheet8.h"
#include "BoundSheet8.h"
//#include <Exception/AttributeDataWrong.h>
#include <boost/lexical_cast.hpp>
namespace
XLS
namespace
XLS
{
{
...
@@ -85,6 +86,10 @@ void BoundSheet8::readFields(CFRecord& record)
...
@@ -85,6 +86,10 @@ void BoundSheet8::readFields(CFRecord& record)
name_
=
name_
.
substr
(
0
,
31
);
name_
=
name_
.
substr
(
0
,
31
);
//cell_links_broken.xls
//cell_links_broken.xls
}
}
if
(
name_
.
empty
())
{
//file(6).xls
name_
=
L"Sheet_"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
record
.
getGlobalWorkbookInfo
()
->
current_sheet
+
1
);
}
record
.
getGlobalWorkbookInfo
()
->
sheets_names
.
push_back
(
name_
);
record
.
getGlobalWorkbookInfo
()
->
sheets_names
.
push_back
(
name_
);
record
.
getGlobalWorkbookInfo
()
->
sheets_state
.
push_back
(
hsState
);
record
.
getGlobalWorkbookInfo
()
->
sheets_state
.
push_back
(
hsState
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
View file @
af81688a
#include "ExternSheet.h"
#include "ExternSheet.h"
#include <Logic/Biff_structures/XTI.h>
#include <Logic/Biff_structures/XTI.h>
#include <Logic/Biff_structures/BiffString.h>
namespace
XLS
namespace
XLS
{
{
...
@@ -36,7 +37,16 @@ void ExternSheet::readFields(CFRecord& record)
...
@@ -36,7 +37,16 @@ void ExternSheet::readFields(CFRecord& record)
{
{
if
(
record
.
getGlobalWorkbookInfo
()
->
Version
<
0x0600
)
if
(
record
.
getGlobalWorkbookInfo
()
->
Version
<
0x0600
)
{
{
record
.
skipNunBytes
(
record
.
getDataSize
()
-
record
.
getRdPtr
());
unsigned
char
type
;
//record.skipNunBytes(record.getDataSize() - record.getRdPtr());
ShortXLAnsiString
stName
;
record
>>
type
>>
stName
;
std
::
wstring
name
=
stName
.
value
();
//int type = stName.value().substr(0, 1).c_str()[0];
if
(
!
name
.
empty
())
record
.
getGlobalWorkbookInfo
()
->
arExternalNames
.
push_back
(
name
);
}
}
else
else
{
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp
View file @
af81688a
...
@@ -76,6 +76,87 @@ int Label::serialize(std::wostream & stream)
...
@@ -76,6 +76,87 @@ int Label::serialize(std::wostream & stream)
}
}
return
0
;
return
0
;
}
}
//----------------------------------------------------------------
CommentText
::
CommentText
()
{
isst_
=
-
1
;
}
CommentText
::~
CommentText
()
{
}
BaseObjectPtr
CommentText
::
clone
()
{
return
BaseObjectPtr
(
new
CommentText
(
*
this
));
}
void
CommentText
::
writeFields
(
CFRecord
&
record
)
{
global_info_
=
record
.
getGlobalWorkbookInfo
();
record
<<
cell
<<
st
;
}
void
CommentText
::
readFields
(
CFRecord
&
record
)
{
global_info_
=
record
.
getGlobalWorkbookInfo
();
//record >> cell;
Rw
row
;
Col
col
;
XLUnicodeString
stText
;
unsigned
short
flags
;
record
>>
row
>>
col
;
if
(
global_info_
->
Version
<
0x0600
)
{
LPAnsiString
stText1
;
record
>>
stText1
;
stText
=
stText1
;
}
else
{
}
isst_
=
global_info_
->
startAddedSharedStrings
+
global_info_
->
arAddedSharedStrings
.
size
()
;
global_info_
->
arAddedSharedStrings
.
push_back
(
st
.
value
());
}
int
CommentText
::
serialize
(
std
::
wostream
&
stream
)
{
CP_XML_WRITER
(
stream
)
{
int
row
=
cell
.
rw
;
std
::
wstring
ref
=
cell
.
getLocation
().
toString
();
// getColRowRef(i, row);
CP_XML_NODE
(
L"c"
)
{
CP_XML_ATTR
(
L"r"
,
ref
);
int
st
=
(
int
)
cell
.
ixfe
-
global_info_
->
cellStyleXfs_count
;
if
(
cell
.
ixfe
>
global_info_
->
cellStyleXfs_count
)
{
CP_XML_ATTR
(
L"s"
,
cell
.
ixfe
-
global_info_
->
cellStyleXfs_count
);
}
CP_XML_ATTR
(
L"t"
,
L"s"
);
CP_XML_NODE
(
L"v"
)
{
CP_XML_STREAM
()
<<
isst_
;
}
}
}
return
0
;
}
}
// namespace XLS
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h
View file @
af81688a
...
@@ -34,5 +34,31 @@ public:
...
@@ -34,5 +34,31 @@ public:
int
isst_
;
int
isst_
;
};
};
class
CommentText
:
public
BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO
(
CommentText
)
BASE_OBJECT_DEFINE_CLASS_NAME
(
CommentText
)
public:
CommentText
();
~
CommentText
();
BaseObjectPtr
clone
();
void
writeFields
(
CFRecord
&
record
);
void
readFields
(
CFRecord
&
record
);
int
serialize
(
std
::
wostream
&
stream
);
static
const
ElementType
type
=
typeLabel
;
Cell
cell
;
XLUnicodeString
st
;
//-----------------------------
GlobalWorkbookInfoPtr
global_info_
;
int
isst_
;
};
}
// namespace XLS
}
// namespace XLS
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/AF12Criteria.h
View file @
af81688a
...
@@ -16,7 +16,6 @@ public:
...
@@ -16,7 +16,6 @@ public:
AF12Criteria
();
AF12Criteria
();
~
AF12Criteria
();
~
AF12Criteria
();
virtual
void
load
(
CFRecord
&
record
);
virtual
void
load
(
CFRecord
&
record
);
virtual
void
store
(
CFRecord
&
record
);
virtual
void
store
(
CFRecord
&
record
);
...
@@ -25,7 +24,7 @@ public:
...
@@ -25,7 +24,7 @@ public:
AFDOper
doper
;
AFDOper
doper
;
XLUnicodeStringNoCch
str
;
XLUnicodeStringNoCch
str
;
BIFF_BSTR
_str
;
std
::
wstring
_str
;
};
};
typedef
boost
::
shared_ptr
<
AF12Criteria
>
AF12CriteriaPtr
;
typedef
boost
::
shared_ptr
<
AF12Criteria
>
AF12CriteriaPtr
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AUTOFILTER_bu.cpp
View file @
af81688a
...
@@ -195,7 +195,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
...
@@ -195,7 +195,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
CP_XML_NODE
(
L"filter"
)
CP_XML_NODE
(
L"filter"
)
{
{
CP_XML_ATTR
(
L"val"
,
*
af12Criteria
->
_str
.
value
()
);
CP_XML_ATTR
(
L"val"
,
af12Criteria
->
_str
);
}
}
}
}
}
}
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/PAGESETUP.cpp
View file @
af81688a
...
@@ -63,7 +63,12 @@ const bool PAGESETUP::loadContent(BinProcessor& proc)
...
@@ -63,7 +63,12 @@ const bool PAGESETUP::loadContent(BinProcessor& proc)
{
{
CFRecordType
::
TypeId
type
=
proc
.
getNextRecordType
();
CFRecordType
::
TypeId
type
=
proc
.
getNextRecordType
();
if
(
type
==
rt_NONE
)
break
;
if
(
type
==
rt_NONE
)
{
proc
.
SkipRecord
();
continue
;
//file(6).xls
//break;
}
switch
(
type
)
switch
(
type
)
{
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorkbookStreamObject.cpp
View file @
af81688a
...
@@ -47,14 +47,15 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
...
@@ -47,14 +47,15 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
{
{
bool
to_continue
=
true
;
bool
to_continue
=
true
;
unsigned
short
substream_type
;
bool
GlobalsSubstream_found
=
false
;
bool
GlobalsSubstream_found
=
false
;
bool
WorksheetSubstream_found
=
false
;
bool
WorksheetSubstream_found
=
false
;
size_t
ws_index
=
0
;
size_t
ws_index
=
0
;
// Find all substreams in this stream
// Find all substreams in this stream
while
(
proc
.
getNextSubstreamType
(
substream_type
)
)
while
(
to_continue
)
{
{
unsigned
short
substream_type
=
0
;
to_continue
=
proc
.
getNextSubstreamType
(
substream_type
);
switch
(
substream_type
)
switch
(
substream_type
)
{
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.cpp
View file @
af81688a
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <Logic/Biff_records/EOF.h>
#include <Logic/Biff_records/EOF.h>
#include <Logic/Biff_records/BOF.h>
#include <Logic/Biff_records/BOF.h>
#include <Logic/Biff_records/DefaultRowHeight.h>
#include <Logic/Biff_records/DefaultRowHeight.h>
#include <Logic/Biff_records/Label.h>
#include <Logic/Biff_unions/BACKGROUND.h>
#include <Logic/Biff_unions/BACKGROUND.h>
#include <Logic/Biff_unions/BIGNAME.h>
#include <Logic/Biff_unions/BIGNAME.h>
...
@@ -185,9 +186,10 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
...
@@ -185,9 +186,10 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
elements_
.
pop_back
();
elements_
.
pop_back
();
}
}
}
break
;
}
break
;
case
rt_Label
:
//file(6).xls
case
rt_Row
:
case
rt_Row
:
{
{
CELLTABLE
cell_table
(
shared_formulas_locations
);
CELLTABLE
cell_table
(
shared_formulas_locations
);
if
(
proc
.
optional
(
cell_table
))
if
(
proc
.
optional
(
cell_table
))
{
{
m_CELLTABLE
=
elements_
.
back
();
m_CELLTABLE
=
elements_
.
back
();
...
@@ -219,6 +221,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
...
@@ -219,6 +221,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
}
}
}
break
;
}
break
;
case
rt_HFPicture
:
proc
.
repeated
<
HFPicture
>
(
0
,
0
);
break
;
case
rt_HFPicture
:
proc
.
repeated
<
HFPicture
>
(
0
,
0
);
break
;
case
rt_CommentText
:
{
count
=
proc
.
repeated
<
CommentText
>
(
0
,
0
);
while
(
count
>
0
)
{
m_arNote
.
insert
(
m_arNote
.
begin
(),
elements_
.
back
());
elements_
.
pop_back
();
count
--
;
}
}
break
;
case
rt_Note
:
case
rt_Note
:
{
{
count
=
proc
.
repeated
<
Note
>
(
0
,
0
);
count
=
proc
.
repeated
<
Note
>
(
0
,
0
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/WorksheetSubstream.h
View file @
af81688a
...
@@ -49,6 +49,7 @@ public:
...
@@ -49,6 +49,7 @@ public:
std
::
vector
<
BaseObjectPtr
>
m_arNote
;
std
::
vector
<
BaseObjectPtr
>
m_arNote
;
std
::
vector
<
BaseObjectPtr
>
m_arHLINK
;
std
::
vector
<
BaseObjectPtr
>
m_arHLINK
;
std
::
vector
<
BaseObjectPtr
>
m_arSORT
;
std
::
vector
<
BaseObjectPtr
>
m_arSORT
;
std
::
vector
<
BaseObjectPtr
>
m_arLabel
;
};
};
}
// namespace XLS
}
// namespace XLS
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp
View file @
af81688a
...
@@ -383,7 +383,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
...
@@ -383,7 +383,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
{
for
(
int
i
=
0
;
i
<
sheet
->
m_arNote
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
sheet
->
m_arNote
.
size
();
i
++
)
{
{
convert
(
(
XLS
::
Note
*
)
sheet
->
m_arNote
[
i
].
get
(
));
convert
(
dynamic_cast
<
XLS
::
Note
*>
(
sheet
->
m_arNote
[
i
].
get
()
));
}
}
}
}
...
...
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