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
4c12ba9c
Commit
4c12ba9c
authored
Nov 23, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - fix bugs...
parent
eae048a8
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
106 deletions
+177
-106
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
+26
-9
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
+3
-0
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.cpp
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.cpp
+98
-63
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.h
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.h
+8
-8
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
+2
-2
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
+1
-1
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
+38
-22
X2tConverter/build/Qt/X2tConverter.pri
X2tConverter/build/Qt/X2tConverter.pri
+1
-1
No files found.
ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp
View file @
4c12ba9c
...
...
@@ -260,12 +260,22 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula_type
=
L"expression"
;
val
=
f
.
substr
(
11
,
f
.
size
()
-
12
);
if
(
0
==
(
pos
=
val
.
find
(
L"
\"
"
)))
//Raport_7A.ods или выкинуть ограждающие кавычки с формулы?
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
text
=
val
;
val
.
clear
();
}
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
converter
.
convert
(
val
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"is-between("
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
converter
.
convert_named_expr
(
val
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"is-time("
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
converter
.
convert_named_expr
(
val
);
}
else
{
...
...
@@ -273,46 +283,50 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
if
(
0
<=
(
pos
=
f
.
find
(
L"!empty"
)))
{
val
=
converter
.
convert_named_expr
(
f
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"empty"
)))
{
val
=
converter
.
convert_named_expr
(
f
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"bottom"
)))
{
val
=
converter
.
convert_named_expr
(
f
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"top"
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula_type
=
L"top10"
;
val
=
converter
.
convert_named_expr
(
f
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"!="
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"notEqual"
;
val
=
f
.
substr
(
2
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
2
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"<="
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"lessThanOrEqual"
;
val
=
f
.
substr
(
2
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
2
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L">="
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"greaterThanOrEqual"
;
val
=
f
.
substr
(
2
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
2
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"="
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"equal"
;
val
=
f
.
substr
(
1
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
1
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"<"
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"lessThan"
;
val
=
f
.
substr
(
1
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
1
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L">"
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
operator_
=
L"greaterThan"
;
val
=
f
.
substr
(
1
);
val
=
converter
.
convert_named_expr
(
f
.
substr
(
1
)
);
}
else
if
(
0
<=
(
pos
=
f
.
find
(
L"contains-text"
)))
{
...
...
@@ -327,17 +341,20 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
if
(
0
<=
(
pos
=
val
.
find
(
L","
)))
{
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula2
=
converter
.
convert_named_expr
(
val
.
substr
(
pos
+
1
)
);
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula2
=
converter
.
convert_named_expr
(
val
.
substr
(
pos
+
1
)
);
val
=
val
.
substr
(
0
,
pos
);
}
val
=
converter
.
convert_named_expr
(
val
);
}
else
{
val
=
f
;
val
=
converter
.
convert
(
f
)
;
}
if
(
!
val
.
empty
())
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
val
;
}
impl_
->
conditionalFormattings_
.
back
().
rules
.
back
().
formula
=
converter
.
convert_named_expr
(
val
);
}
void
xlsx_conditionalFormatting_context
::
set_dataBar
(
_CP_OPT
(
int
)
min
,
_CP_OPT
(
int
)
max
)
{
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
View file @
4c12ba9c
...
...
@@ -471,6 +471,9 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
x
=
obj
.
anchor_x_
-
cx
;
y
=
obj
.
anchor_y_
-
cy
;
if
(
x
<
0
)
x
=
0
;
if
(
y
<
0
)
y
=
0
;
// calcul dun MS.ods
to
=
pos_anchor
;
from
=
table_metrics
.
calc
(
x
,
y
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.cpp
View file @
4c12ba9c
This diff is collapsed.
Click to expand it.
ASCOfficeOdfFile/src/docx/xlsx_table_metrics.h
View file @
4c12ba9c
...
...
@@ -44,18 +44,18 @@ namespace oox
class
xlsx_table_metrics
{
public:
xlsx_table_metrics
();
~
xlsx_table_metrics
();
xlsx_table_metrics
();
~
xlsx_table_metrics
();
public:
xlsx_table_position
calc
(
double
x_pt
,
double
y_pt
);
xlsx_table_position
calc
(
size_t
offset_col
,
size_t
offset_row
,
double
x_pt
,
double
y_pt
);
xlsx_table_position
calc
(
size_t
last_col
,
size_
t
last_row
);
xlsx_table_position
calc
(
double
x_pt
,
double
y_pt
);
xlsx_table_position
calc
(
int
offset_col
,
int
offset_row
,
double
x_pt
,
double
y_pt
);
xlsx_table_position
calc
(
int
last_col
,
in
t
last_row
);
void
update_pt
(
size_t
offset_col
,
size_t
offset_row
,
double
&
x_pt
,
double
&
y_pt
);
void
update_pt
(
int
offset_col
,
int
offset_row
,
double
&
x_pt
,
double
&
y_pt
);
void
add_cols
(
size_
t
count
,
double
widht_pt
);
void
add_rows
(
size_
t
count
,
double
height_pt
);
void
add_cols
(
in
t
count
,
double
widht_pt
);
void
add_rows
(
in
t
count
,
double
height_pt
);
private:
class
Impl
;
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
View file @
4c12ba9c
...
...
@@ -191,8 +191,8 @@ std::wstring xlsx_table_state::default_row_cell_style() const
std
::
wstring
xlsx_table_state
::
default_column_cell_style
()
const
{
if
(
current_table_column_
<
column_default_cell_style_name_
.
size
())
return
column_default_cell_style_name_
.
at
(
current_table_column_
);
if
(
current_table_column_
+
1
<
column_default_cell_style_name_
.
size
())
return
column_default_cell_style_name_
.
at
(
current_table_column_
+
1
);
else
{
//непонятная хрень!! - неправильно сформирован ods???
...
...
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
View file @
4c12ba9c
...
...
@@ -179,7 +179,7 @@ void xlsx_conversion_context::end_document()
{
CP_XML_NODE
(
L"sheet"
)
{
CP_XML_ATTR
(
L"name"
,
sheet
->
name
());
CP_XML_ATTR
(
L"name"
,
sheet
->
name
());
// office 2010 ! ограничение на длину имени !!!
CP_XML_ATTR
(
L"sheetId"
,
count
);
CP_XML_ATTR
(
L"state"
,
L"visible"
);
CP_XML_ATTR
(
L"r:id"
,
id
);
...
...
ASCOfficeOdfFile/src/odf/table_xlsx.cpp
View file @
4c12ba9c
...
...
@@ -604,45 +604,49 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std
::
wostream
&
strm
=
Context
.
current_sheet
().
sheetData
();
const
std
::
wstring
formula
=
table_table_cell_attlist_
.
table_formula_
.
get_value_or
(
L""
);
const
std
::
wstring
styleName
=
table_table_cell_attlist_
.
table_style_name_
.
get_value_or
(
L""
);
const
common_value_and_type_attlist
&
attr
=
table_table_cell_attlist_
.
common_value_and_type_attlist_
;
office_value_type
::
type
odf_value_type
=
office_value_type
::
Custom
;
oox
::
XlsxCellType
::
type
t_val
=
oox
::
XlsxCellType
::
s
;
std
::
wstring
number_val
=
L""
;
std
::
wstring
formula
=
table_table_cell_attlist_
.
table_formula_
.
get_value_or
(
L""
);
std
::
wstring
number_val
;
_CP_OPT
(
bool
)
bool_val
;
_CP_OPT
(
std
::
wstring
)
str_val
;
std
::
wstring
num_format
=
L""
;
std
::
wstring
num_format
;
size_t
xfId_last_set
=
0
;
int
empty_cell_count
=
0
;
bool
skip_next_cell
=
false
;
bool
is_style_visible
=
true
;
bool
is_data_visible
=
false
;
// вычислить стиль для ячейки
std
::
wstring
cellStyleName
=
table_table_cell_attlist_
.
table_style_name_
.
get_value_or
(
L""
);
std
::
wstring
columnStyleName
=
Context
.
get_table_context
().
default_column_cell_style
();
std
::
wstring
rowStyleName
=
Context
.
get_table_context
().
default_row_cell_style
();
if
(
table_table_cell_attlist_
.
table_number_columns_repeated_
>
1
)
columnStyleName
.
clear
();
// могут быть разные стили колонок Book 24.ods
// вычислить стиль для ячейки
odf_read_context
&
odfContext
=
Context
.
root
()
->
odf_context
();
style_instance
*
defaultCellStyle
=
NULL
,
*
defaultColumnCellStyle
=
NULL
,
*
defaultRowCellStyle
=
NULL
,
*
cellStyle
=
NULL
;
try
{
defaultCellStyle
=
odfContext
.
styleContainer
().
style_default_by_type
(
style_family
::
TableCell
);
defaultColumnCellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
Context
.
get_table_context
().
default_column_cell_style
(),
style_family
::
TableCell
,
false
);
defaultRowCellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
Context
.
get_table_context
().
default_row_cell_style
(),
style_family
::
TableCell
,
false
);
cellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
styleName
,
style_family
::
TableCell
,
false
);
defaultColumnCellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
columnStyleName
,
style_family
::
TableCell
,
false
);
defaultRowCellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
rowStyleName
,
style_family
::
TableCell
,
false
);
cellStyle
=
odfContext
.
styleContainer
().
style_by_name
(
cellStyleName
,
style_family
::
TableCell
,
false
);
}
catch
(...)
{
_CP_LOG
<<
L"[error]: style wrong
\n
"
;
}
std
::
wstring
data_style
=
CalcCellDataStyle
(
Context
,
Context
.
get_table_context
().
default_column_cell_style
(),
Context
.
get_table_context
().
default_row_cell_style
(),
styleName
);
std
::
wstring
data_style
=
CalcCellDataStyle
(
Context
,
columnStyleName
,
rowStyleName
,
cellStyleName
);
// стили не наследуются
std
::
vector
<
const
style_instance
*>
instances
;
...
...
@@ -751,9 +755,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
cellFormat
.
set_cell_type
(
t_val
);
cellFormat
.
set_num_format
(
oox
::
odf_string_to_build_in
(
odf_value_type
));
is_style_visible
=
(
styleName
.
length
()
>
0
||
defaultColumnCellStyle
)
?
true
:
false
;
xfId_last_set
=
Context
.
get_style_manager
().
xfId
(
&
textFormatProperties
,
&
parFormatProperties
,
&
cellFormatProperties
,
&
cellFormat
,
num_format
,
false
,
is_style_visible
);
is_style_visible
=
(
!
cellStyleName
.
empty
()
||
defaultColumnCellStyle
)
?
true
:
false
;
if
(
table_table_cell_content_
.
elements_
.
size
()
>
0
||
!
formula
.
empty
()
||
...
...
@@ -763,10 +765,24 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
if
(
table_table_cell_attlist_
.
table_number_columns_repeated_
<
199
&&
last_cell_
)
last_cell_
=
false
;
int
cell_repeated_max
=
Context
.
current_table_column
()
+
table_table_cell_attlist_
.
table_number_columns_repeated_
+
1
;
if
(
cell_repeated_max
>=
1024
&&
cellStyleName
.
empty
()
&&
last_cell_
&&
!
is_data_visible
)
{
//Book 24.ods
return
;
}
if
(
is_style_visible
)
{
xfId_last_set
=
Context
.
get_style_manager
().
xfId
(
&
textFormatProperties
,
&
parFormatProperties
,
&
cellFormatProperties
,
&
cellFormat
,
num_format
,
false
,
is_style_visible
);
}
for
(
unsigned
int
r
=
0
;
r
<
table_table_cell_attlist_
.
table_number_columns_repeated_
;
++
r
)
{
Context
.
start_table_cell
(
formula
,
table_table_cell_attlist_extra_
.
table_number_columns_spanned_
-
1
,
table_table_cell_attlist_extra_
.
table_number_rows_spanned_
-
1
);
if
(
is_style_visible
)
Context
.
set_current_cell_style_id
(
xfId_last_set
);
const
int
sharedStringId
=
table_table_cell_content_
.
xlsx_convert
(
Context
,
&
textFormatProperties
);
...
...
X2tConverter/build/Qt/X2tConverter.pri
View file @
4c12ba9c
...
...
@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.0.2.41
0
VERSION = 2.0.2.41
1
DEFINES += INTVER=$$VERSION
TARGET = x2t
...
...
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