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
d76b1897
Commit
d76b1897
authored
Jan 25, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save conditionalFormating to xlsx
parent
857b79ee
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
263 additions
and
13 deletions
+263
-13
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
+1
-1
Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
...rmat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
+19
-6
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
+5
-1
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+2
-2
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+236
-3
No files found.
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
View file @
d76b1897
...
...
@@ -2077,7 +2077,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_f
if
(
oox_cond_fmt
->
m_oSqRef
.
IsInit
())
{
ods_context
->
current_table
().
start_conditional_format
(
oox_cond_fmt
->
m_oSqRef
->
GetValue
());
ods_context
->
current_table
().
start_conditional_format
(
oox_cond_fmt
->
m_oSqRef
.
get
());
for
(
unsigned
int
i
=
0
;
i
<
oox_cond_fmt
->
m_arrItems
.
size
();
i
++
)
convert
(
oox_cond_fmt
->
m_arrItems
[
i
]);
//rule
...
...
Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h
View file @
d76b1897
...
...
@@ -386,7 +386,7 @@ namespace OOX
}
virtual
void
toXML
(
NSStringUtils
::
CStringBuilder
&
writer
)
const
{
if
(
m_oType
.
IsInit
()
&&
m_oPriority
.
IsInit
()
&&
0
<
m_arrItems
.
size
())
if
(
isValid
())
{
writer
.
WriteString
(
L"<cfRule"
);
WritingStringAttrString
(
L"type"
,
m_oType
->
ToString
());
...
...
@@ -398,7 +398,7 @@ namespace OOX
WritingStringNullableAttrInt
(
L"dxfId"
,
m_oDxfId
,
m_oDxfId
->
GetValue
());
if
(
m_oEqualAverage
.
IsInit
()
&&
true
==
m_oEqualAverage
->
ToBool
())
writer
.
WriteString
(
_T
(
" equalAverage=
\"
1
\"
"
));
WritingStringNullableAttrString
(
L"
text
"
,
m_oOperator
,
m_oOperator
->
ToString
());
WritingStringNullableAttrString
(
L"
operator
"
,
m_oOperator
,
m_oOperator
->
ToString
());
if
(
m_oPercent
.
IsInit
()
&&
true
==
m_oPercent
->
ToBool
())
writer
.
WriteString
(
_T
(
" percent=
\"
1
\"
"
));
WritingStringNullableAttrInt
(
L"rank"
,
m_oRank
,
m_oRank
->
GetValue
());
...
...
@@ -443,6 +443,11 @@ namespace OOX
return
et_ConditionalFormattingRule
;
}
bool
isValid
()
const
{
return
m_oType
.
IsInit
()
&&
m_oPriority
.
IsInit
();
}
private:
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
...
...
@@ -503,11 +508,19 @@ namespace OOX
}
virtual
void
toXML
(
NSStringUtils
::
CStringBuilder
&
writer
)
const
{
if
(
m_oSqRef
.
IsInit
()
&&
0
<
m_arrItems
.
size
())
bool
isValid
=
false
;
for
(
int
i
=
0
;
i
<
m_arrItems
.
size
();
++
i
)
{
if
(
m_arrItems
[
i
]
->
isValid
())
{
isValid
=
true
;
break
;
}
}
if
(
m_oSqRef
.
IsInit
()
&&
isValid
)
{
std
::
wstring
sRoot
;
writer
.
WriteString
(
L"<conditionalFormatting"
);
WritingStringAttrString
(
L"sqref"
,
m_oSqRef
->
ToString
());
WritingStringAttrString
(
L"sqref"
,
m_oSqRef
.
get
());
if
(
m_oPivot
.
IsInit
()
&&
true
==
m_oPivot
->
ToBool
())
{
...
...
@@ -557,7 +570,7 @@ namespace OOX
}
public:
nullable
<
SimpleTypes
::
COnOff
<>>
m_oPivot
;
nullable
<
SimpleTypes
::
CRelationshipId
>
m_oSqRef
;
// ToDo переделать на тип "sqref" (18.18.76) - последовательность "ref", разделенные пробелом
nullable
<
std
::
wstring
>
m_oSqRef
;
// ToDo переделать на тип "sqref" (18.18.76) - последовательность "ref", разделенные пробелом
};
}
//Spreadsheet
}
// namespace OOX
...
...
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
View file @
d76b1897
...
...
@@ -348,7 +348,7 @@ namespace OOX
if
(
m_oSheetData
.
IsInit
())
m_oSheetData
->
toXML
(
sXml
);
for
(
unsigned
int
nIndex
=
0
,
nLength
=
m_arrConditionalFormatting
.
size
();
nIndex
<
nLength
;
++
nIndex
)
m_arrConditionalFormatting
[
nIndex
]
->
toXML
();
m_arrConditionalFormatting
[
nIndex
]
->
toXML
(
sXml
);
if
(
m_oAutofilter
.
IsInit
())
m_oAutofilter
->
toXML
(
sXml
);
if
(
m_oMergeCells
.
IsInit
())
...
...
@@ -425,6 +425,10 @@ namespace OOX
m_mapComments
.
clear
();
// delete Conditional Formatting
for
(
unsigned
int
nIndex
=
0
,
nLength
=
m_arrConditionalFormatting
.
size
();
nIndex
<
nLength
;
++
nIndex
)
{
delete
m_arrConditionalFormatting
[
nIndex
];
}
m_arrConditionalFormatting
.
clear
();
}
private:
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
d76b1897
...
...
@@ -3287,7 +3287,7 @@ namespace BinXlsxRW {
if
(
oConditionalFormatting
.
m_oSqRef
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSer_ConditionalFormatting
::
SqRef
);
m_oBcw
.
m_oStream
.
WriteStringW
(
oConditionalFormatting
.
m_oSqRef
->
ToString
());
m_oBcw
.
m_oStream
.
WriteStringW
(
oConditionalFormatting
.
m_oSqRef
.
get
());
}
if
(
0
<
oConditionalFormatting
.
m_arrItems
.
size
())
...
...
@@ -3323,7 +3323,7 @@ namespace BinXlsxRW {
}
if
(
oConditionalFormattingRule
.
m_oDxfId
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_
TableColumns
::
Data
DxfId
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_
ConditionalFormattingRule
::
DxfId
);
m_oBcw
.
m_oStream
.
WriteLONG
(
oConditionalFormattingRule
.
m_oDxfId
->
GetValue
());
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
...
...
XlsxSerializerCom/Writer/BinaryReader.h
View file @
d76b1897
...
...
@@ -2014,8 +2014,9 @@ namespace BinXlsxRW {
}
else
if
(
c_oSerWorksheetsTypes
::
ConditionalFormatting
==
type
)
{
// ToDo
res
=
c_oSerConstants
::
ReadUnknown
;
OOX
::
Spreadsheet
::
CConditionalFormatting
*
pConditionalFormatting
=
new
OOX
::
Spreadsheet
::
CConditionalFormatting
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadConditionalFormatting
,
this
,
pConditionalFormatting
);
m_pCurWorksheet
->
m_arrConditionalFormatting
.
push_back
(
pConditionalFormatting
);
}
else
if
(
c_oSerWorksheetsTypes
::
Comments
==
type
)
{
...
...
@@ -3128,6 +3129,238 @@ namespace BinXlsxRW {
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadConditionalFormatting
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CConditionalFormatting
*
pConditionalFormatting
=
static_cast
<
OOX
::
Spreadsheet
::
CConditionalFormatting
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormatting
::
Pivot
==
type
)
{
pConditionalFormatting
->
m_oPivot
.
Init
();
pConditionalFormatting
->
m_oPivot
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormatting
::
SqRef
==
type
)
{
pConditionalFormatting
->
m_oSqRef
.
Init
();
pConditionalFormatting
->
m_oSqRef
->
append
(
m_oBufferedStream
.
GetString4
(
length
));
}
else
if
(
c_oSer_ConditionalFormatting
::
ConditionalFormattingRule
==
type
)
{
OOX
::
Spreadsheet
::
CConditionalFormattingRule
*
pConditionalFormattingRule
=
new
OOX
::
Spreadsheet
::
CConditionalFormattingRule
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadConditionalFormattingRule
,
this
,
pConditionalFormattingRule
);
pConditionalFormatting
->
m_arrItems
.
push_back
(
pConditionalFormattingRule
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadConditionalFormattingRule
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CConditionalFormattingRule
*
pConditionalFormattingRule
=
static_cast
<
OOX
::
Spreadsheet
::
CConditionalFormattingRule
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormattingRule
::
AboveAverage
==
type
)
{
pConditionalFormattingRule
->
m_oAboveAverage
.
Init
();
pConditionalFormattingRule
->
m_oAboveAverage
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Bottom
==
type
)
{
pConditionalFormattingRule
->
m_oBottom
.
Init
();
pConditionalFormattingRule
->
m_oBottom
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
DxfId
==
type
)
{
pConditionalFormattingRule
->
m_oDxfId
.
Init
();
pConditionalFormattingRule
->
m_oDxfId
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
EqualAverage
==
type
)
{
pConditionalFormattingRule
->
m_oEqualAverage
.
Init
();
pConditionalFormattingRule
->
m_oEqualAverage
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Operator
==
type
)
{
pConditionalFormattingRule
->
m_oOperator
.
Init
();
pConditionalFormattingRule
->
m_oOperator
->
SetValue
((
SimpleTypes
::
Spreadsheet
::
ECfOperator
)
m_oBufferedStream
.
GetUChar
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Percent
==
type
)
{
pConditionalFormattingRule
->
m_oPercent
.
Init
();
pConditionalFormattingRule
->
m_oPercent
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Priority
==
type
)
{
pConditionalFormattingRule
->
m_oPriority
.
Init
();
pConditionalFormattingRule
->
m_oPriority
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Rank
==
type
)
{
pConditionalFormattingRule
->
m_oRank
.
Init
();
pConditionalFormattingRule
->
m_oRank
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
StdDev
==
type
)
{
pConditionalFormattingRule
->
m_oStdDev
.
Init
();
pConditionalFormattingRule
->
m_oStdDev
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
StopIfTrue
==
type
)
{
pConditionalFormattingRule
->
m_oStopIfTrue
.
Init
();
pConditionalFormattingRule
->
m_oStopIfTrue
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Text
==
type
)
{
pConditionalFormattingRule
->
m_oText
.
Init
();
pConditionalFormattingRule
->
m_oText
->
append
(
m_oBufferedStream
.
GetString4
(
length
));
}
else
if
(
c_oSer_ConditionalFormattingRule
::
TimePeriod
==
type
)
{
pConditionalFormattingRule
->
m_oTimePeriod
.
Init
();
pConditionalFormattingRule
->
m_oTimePeriod
->
append
(
m_oBufferedStream
.
GetString4
(
length
));
}
else
if
(
c_oSer_ConditionalFormattingRule
::
Type
==
type
)
{
pConditionalFormattingRule
->
m_oType
.
Init
();
pConditionalFormattingRule
->
m_oType
->
SetValue
((
SimpleTypes
::
Spreadsheet
::
ECfType
)
m_oBufferedStream
.
GetUChar
());
}
else
if
(
c_oSer_ConditionalFormattingRule
::
ColorScale
==
type
)
{
OOX
::
Spreadsheet
::
CColorScale
*
pColorScale
=
new
OOX
::
Spreadsheet
::
CColorScale
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadColorScale
,
this
,
pColorScale
);
pConditionalFormattingRule
->
m_arrItems
.
push_back
(
pColorScale
);
}
else
if
(
c_oSer_ConditionalFormattingRule
::
DataBar
==
type
)
{
OOX
::
Spreadsheet
::
CDataBar
*
pDataBar
=
new
OOX
::
Spreadsheet
::
CDataBar
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadDataBar
,
this
,
pDataBar
);
pConditionalFormattingRule
->
m_arrItems
.
push_back
(
pDataBar
);
}
else
if
(
c_oSer_ConditionalFormattingRule
::
FormulaCF
==
type
)
{
OOX
::
Spreadsheet
::
CFormulaCF
*
pFormulaCF
=
new
OOX
::
Spreadsheet
::
CFormulaCF
();
pFormulaCF
->
m_sText
.
append
(
m_oBufferedStream
.
GetString4
(
length
));
pConditionalFormattingRule
->
m_arrItems
.
push_back
(
pFormulaCF
);
}
else
if
(
c_oSer_ConditionalFormattingRule
::
IconSet
==
type
)
{
OOX
::
Spreadsheet
::
CIconSet
*
pIconSet
=
new
OOX
::
Spreadsheet
::
CIconSet
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadIconSet
,
this
,
pIconSet
);
pConditionalFormattingRule
->
m_arrItems
.
push_back
(
pIconSet
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadColorScale
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CColorScale
*
pColorScale
=
static_cast
<
OOX
::
Spreadsheet
::
CColorScale
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormattingRuleColorScale
::
CFVO
==
type
)
{
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
*
pCFVO
=
new
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadCFVO
,
this
,
pCFVO
);
pColorScale
->
m_arrItems
.
push_back
(
pCFVO
);
}
else
if
(
c_oSer_ConditionalFormattingRuleColorScale
::
Color
==
type
)
{
OOX
::
Spreadsheet
::
CColor
*
pColor
=
new
OOX
::
Spreadsheet
::
CColor
();
res
=
Read2
(
length
,
&
BinaryWorksheetsTableReader
::
ReadColor
,
this
,
pColor
);
pColorScale
->
m_arrItems
.
push_back
(
pColor
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadDataBar
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CDataBar
*
pDataBar
=
static_cast
<
OOX
::
Spreadsheet
::
CDataBar
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormattingDataBar
::
MaxLength
==
type
)
{
pDataBar
->
m_oMaxLength
.
Init
();
pDataBar
->
m_oMaxLength
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingDataBar
::
MinLength
==
type
)
{
pDataBar
->
m_oMinLength
.
Init
();
pDataBar
->
m_oMinLength
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSer_ConditionalFormattingDataBar
::
ShowValue
==
type
)
{
pDataBar
->
m_oShowValue
.
Init
();
pDataBar
->
m_oShowValue
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingDataBar
::
Color
==
type
)
{
pDataBar
->
m_oColor
.
Init
();
res
=
Read2
(
length
,
&
BinaryWorksheetsTableReader
::
ReadColor
,
this
,
pDataBar
->
m_oColor
.
GetPointer
());
}
else
if
(
c_oSer_ConditionalFormattingDataBar
::
CFVO
==
type
)
{
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
*
pCFVO
=
new
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadCFVO
,
this
,
pCFVO
);
pDataBar
->
m_arrItems
.
push_back
(
pCFVO
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadIconSet
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CIconSet
*
pIconSet
=
static_cast
<
OOX
::
Spreadsheet
::
CIconSet
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormattingIconSet
::
IconSet
==
type
)
{
pIconSet
->
m_oIconSet
.
Init
();
pIconSet
->
m_oIconSet
->
SetValue
((
SimpleTypes
::
Spreadsheet
::
EIconSetType
)
m_oBufferedStream
.
GetUChar
());
}
else
if
(
c_oSer_ConditionalFormattingIconSet
::
Percent
==
type
)
{
pIconSet
->
m_oPercent
.
Init
();
pIconSet
->
m_oPercent
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingIconSet
::
Reverse
==
type
)
{
pIconSet
->
m_oReverse
.
Init
();
pIconSet
->
m_oReverse
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingIconSet
::
ShowValue
==
type
)
{
pIconSet
->
m_oShowValue
.
Init
();
pIconSet
->
m_oShowValue
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingIconSet
::
CFVO
==
type
)
{
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
*
pCFVO
=
new
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
();
res
=
Read1
(
length
,
&
BinaryWorksheetsTableReader
::
ReadCFVO
,
this
,
pCFVO
);
pIconSet
->
m_arrItems
.
push_back
(
pCFVO
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadCFVO
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
*
pCFVO
=
static_cast
<
OOX
::
Spreadsheet
::
CConditionalFormatValueObject
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSer_ConditionalFormattingValueObject
::
Gte
==
type
)
{
pCFVO
->
m_oGte
.
Init
();
pCFVO
->
m_oGte
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSer_ConditionalFormattingValueObject
::
Type
==
type
)
{
pCFVO
->
m_oType
.
Init
();
pCFVO
->
m_oType
->
SetValue
((
SimpleTypes
::
Spreadsheet
::
ECfvoType
)
m_oBufferedStream
.
GetUChar
());
}
else
if
(
c_oSer_ConditionalFormattingValueObject
::
Val
==
type
)
{
pCFVO
->
m_oVal
.
Init
();
pCFVO
->
m_oVal
->
append
(
m_oBufferedStream
.
GetString4
(
length
));
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
int
ReadSparklineGroups
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Spreadsheet
::
CSparklineGroups
*
pSparklineGroups
=
static_cast
<
OOX
::
Spreadsheet
::
CSparklineGroups
*>
(
poResult
);
...
...
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