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()
...
@@ -275,57 +275,70 @@ CTable.prototype.private_RecalculateGrid = function()
TableW
=
MinWidth
;
TableW
=
MinWidth
;
}
}
var
CurGridCol
=
0
;
var
CurGridCol
=
0
;
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
{
{
var
Row
=
this
.
Content
[
Index
];
var
Row
=
this
.
Content
[
Index
];
Row
.
Set_Index
(
Index
);
Row
.
Set_Index
(
Index
);
// Смотрим на ширину пропущенных колонок сетки в начале строки
// Смотрим на ширину пропущенных колонок сетки в начале строки
var
BeforeInfo
=
Row
.
Get_Before
();
var
BeforeInfo
=
Row
.
Get_Before
();
CurGridCol
=
BeforeInfo
.
GridBefore
;
CurGridCol
=
BeforeInfo
.
GridBefore
;
if
(
CurGridCol
>
0
&&
SumGrid
[
CurGridCol
-
1
]
<
BeforeInfo
.
WBefore
.
W
)
if
(
CurGridCol
>
0
&&
SumGrid
[
CurGridCol
-
1
]
<
BeforeInfo
.
WBefore
.
W
)
SumGrid
[
CurGridCol
-
1
]
=
BeforeInfo
.
WBefore
.
W
;
{
var
nTempDiff
=
BeforeInfo
.
WBefore
.
W
-
SumGrid
[
CurGridCol
-
1
];
var
CellsCount
=
Row
.
Get_CellsCount
();
for
(
var
nTempIndex
=
CurGridCol
-
1
;
nTempIndex
<
SumGrid
.
length
;
++
nTempIndex
)
for
(
var
CellIndex
=
0
;
CellIndex
<
CellsCount
;
CellIndex
++
)
SumGrid
[
nTempIndex
]
+=
nTempDiff
;
{
}
var
Cell
=
Row
.
Get_Cell
(
CellIndex
);
Cell
.
Set_Index
(
CellIndex
);
var
CellsCount
=
Row
.
Get_CellsCount
();
var
CellW
=
Cell
.
Get_W
();
for
(
var
CellIndex
=
0
;
CellIndex
<
CellsCount
;
CellIndex
++
)
var
GridSpan
=
Cell
.
Get_GridSpan
();
{
var
Cell
=
Row
.
Get_Cell
(
CellIndex
);
if
(
CurGridCol
+
GridSpan
-
1
>
SumGrid
.
length
)
Cell
.
Set_Index
(
CellIndex
);
{
var
CellW
=
Cell
.
Get_W
();
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
GridSpan
-
1
;
AddIndex
++
)
var
GridSpan
=
Cell
.
Get_GridSpan
();
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
}
if
(
CurGridCol
+
GridSpan
-
1
>
SumGrid
.
length
)
{
if
(
tblwidth_Auto
!==
CellW
.
Type
&&
tblwidth_Nil
!==
CellW
.
Type
)
for
(
var
AddIndex
=
SumGrid
.
length
;
AddIndex
<=
CurGridCol
+
GridSpan
-
1
;
AddIndex
++
)
{
SumGrid
[
AddIndex
]
=
SumGrid
[
AddIndex
-
1
]
+
20
;
// Добавляем столбик шириной в 2 см
var
CellWidth
=
0
;
}
if
(
tblwidth_Pct
===
CellW
.
Type
)
CellWidth
=
PctWidth
*
CellW
.
W
/
100
;
if
(
tblwidth_Auto
!==
CellW
.
Type
&&
tblwidth_Nil
!==
CellW
.
Type
)
else
{
CellWidth
=
CellW
.
W
;
var
CellWidth
=
0
;
if
(
tblwidth_Pct
===
CellW
.
Type
)
if
(
CellWidth
+
SumGrid
[
CurGridCol
-
1
]
>
SumGrid
[
CurGridCol
+
GridSpan
-
1
])
CellWidth
=
PctWidth
*
CellW
.
W
/
100
;
SumGrid
[
CurGridCol
+
GridSpan
-
1
]
=
CellWidth
+
SumGrid
[
CurGridCol
-
1
];
else
}
CellWidth
=
CellW
.
W
;
CurGridCol
+=
GridSpan
;
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
)
var
AfterInfo
=
Row
.
Get_After
();
SumGrid
[
nTempIndex
]
+=
nTempDiff
;
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 см
CurGridCol
+=
GridSpan
;
}
}
if
(
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
]
<
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
]
)
SumGrid
[
CurGridCol
+
AfterInfo
.
GridAfter
-
1
]
=
AfterInfo
.
WAfter
+
SumGrid
[
CurGridCol
-
1
];
// Смотрим на ширину пропущенных колонок сетки в конце строки
}
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: разобраться с минимальной шириной таблицы и ячеек
// 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