Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
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
sdkjs
Commits
31433402
Commit
31433402
authored
Aug 03, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with calculating table grid.
parent
9bc428f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
51 deletions
+64
-51
word/Editor/Table/TableRecalculate.js
word/Editor/Table/TableRecalculate.js
+64
-51
No files found.
word/Editor/Table/TableRecalculate.js
View file @
31433402
...
...
@@ -275,57 +275,70 @@ CTable.prototype.private_RecalculateGrid = function()
TableW
=
MinWidth
;
}
var
CurGridCol
=
0
;
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
{
var
Row
=
this
.
Content
[
Index
];
Row
.
Set_Index
(
Index
);
// Смотрим на ширину пропущенных колонок сетки в начале строки
var
BeforeInfo
=
Row
.
Get_Before
();
CurGridCol
=
BeforeInfo
.
GridBefore
;
if
(
CurGridCol
>
0
&&
SumGrid
[
CurGridCol
-
1
]
<
BeforeInfo
.
WBefore
.
W
)
SumGrid
[
CurGridCol
-
1
]
=
BeforeInfo
.
WBefore
.
W
;
var
CellsCount
=
Row
.
Get_CellsCount
();
for
(
var
CellIndex
=
0
;
CellIndex
<
CellsCount
;
CellIndex
++
)
{
var
Cell
=
Row
.
Get_Cell
(
CellIndex
);
Cell
.
Set_Index
(
CellIndex
);
var
CellW
=
Cell
.
Get_W
();
var
GridSpan
=
Cell
.
Get_GridSpan
();
if
(
CurGridCol
+
GridSpan
-
1
>
SumGrid
.
length
)
{
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
GridSpan
-
1
;
AddIndex
++
)
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
}
if
(
tblwidth_Auto
!==
CellW
.
Type
&&
tblwidth_Nil
!==
CellW
.
Type
)
{
var
CellWidth
=
0
;
if
(
tblwidth_Pct
===
CellW
.
Type
)
CellWidth
=
PctWidth
*
CellW
.
W
/
100
;
else
CellWidth
=
CellW
.
W
;
if
(
CellWidth
+
SumGrid
[
CurGridCol
-
1
]
>
SumGrid
[
CurGridCol
+
GridSpan
-
1
])
SumGrid
[
CurGridCol
+
GridSpan
-
1
]
=
CellWidth
+
SumGrid
[
CurGridCol
-
1
];
}
CurGridCol
+=
GridSpan
;
}
// Смотрим на ширину пропущенных колонок сетки в конце строки
var
AfterInfo
=
Row
.
Get_After
();
if
(
CurGridCol
+
AfterInfo
.
GridAfter
-
1
>
SumGrid
.
length
)
{
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
AfterInfo
.
GridAfter
-
1
;
AddIndex
++
)
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
}
if
(
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
]
<
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
]
)
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
]
=
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
];
}
var
CurGridCol
=
0
;
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
{
var
Row
=
this
.
Content
[
Index
];
Row
.
Set_Index
(
Index
);
// Смотрим на ширину пропущенных колонок сетки в начале строки
var
BeforeInfo
=
Row
.
Get_Before
();
CurGridCol
=
BeforeInfo
.
GridBefore
;
if
(
CurGridCol
>
0
&&
SumGrid
[
CurGridCol
-
1
]
<
BeforeInfo
.
WBefore
.
W
)
{
var
nTempDiff
=
BeforeInfo
.
WBefore
.
W
-
SumGrid
[
CurGridCol
-
1
];
for
(
var
nTempIndex
=
CurGridCol
-
1
;
nTempIndex
<
SumGrid
.
length
;
++
nTempIndex
)
SumGrid
[
nTempIndex
]
+=
nTempDiff
;
}
var
CellsCount
=
Row
.
Get_CellsCount
();
for
(
var
CellIndex
=
0
;
CellIndex
<
CellsCount
;
CellIndex
++
)
{
var
Cell
=
Row
.
Get_Cell
(
CellIndex
);
Cell
.
Set_Index
(
CellIndex
);
var
CellW
=
Cell
.
Get_W
();
var
GridSpan
=
Cell
.
Get_GridSpan
();
if
(
CurGridCol
+
GridSpan
-
1
>
SumGrid
.
length
)
{
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
GridSpan
-
1
;
AddIndex
++
)
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
}
if
(
tblwidth_Auto
!==
CellW
.
Type
&&
tblwidth_Nil
!==
CellW
.
Type
)
{
var
CellWidth
=
0
;
if
(
tblwidth_Pct
===
CellW
.
Type
)
CellWidth
=
PctWidth
*
CellW
.
W
/
100
;
else
CellWidth
=
CellW
.
W
;
if
(
CellWidth
+
SumGrid
[
CurGridCol
-
1
]
>
SumGrid
[
CurGridCol
+
GridSpan
-
1
])
{
var
nTempDiff
=
CellWidth
+
SumGrid
[
CurGridCol
-
1
]
-
SumGrid
[
CurGridCol
+
GridSpan
-
1
];
for
(
var
nTempIndex
=
CurGridCol
+
GridSpan
-
1
;
nTempIndex
<
SumGrid
.
length
;
++
nTempIndex
)
SumGrid
[
nTempIndex
]
+=
nTempDiff
;
}
}
CurGridCol
+=
GridSpan
;
}
// Смотрим на ширину пропущенных колонок сетки в конце строки
var
AfterInfo
=
Row
.
Get_After
();
if
(
CurGridCol
+
AfterInfo
.
GridAfter
-
1
>
SumGrid
.
length
)
{
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
AfterInfo
.
GridAfter
-
1
;
AddIndex
++
)
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
}
if
(
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
]
<
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
])
{
var
nTempDiff
=
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
]
-
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
];
for
(
var
nTempIndex
=
CurGridCol
+
AfterInfo
.
GridAfter
-
1
;
nTempIndex
<
SumGrid
.
length
;
++
nTempIndex
)
SumGrid
[
nTempIndex
]
+=
nTempDiff
;
}
}
// TODO: разобраться с минимальной шириной таблицы и ячеек
...
...
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