Skip to content

Commit b2d4a63

Browse files
author
Florian Krabbenhoeft
committed
Migradoc/DocumentObjectModel/Tables: Ported simplified index set from 1.50.
1 parent 3667f9a commit b2d4a63

File tree

2 files changed

+12
-4
lines changed
  • MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables

2 files changed

+12
-4
lines changed

MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Column.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ public int Index
117117
{
118118
if (!index.HasValue)
119119
{
120-
Columns clms = this.Parent as Columns;
121-
SetValue("Index", index = clms.IndexOf(this));
120+
Columns clms = (Columns)Parent;
121+
// One for all and all for one.
122+
for (int i = 0; i < clms.Count; ++i)
123+
{
124+
clms[i].index = i;
125+
}
122126
}
123127
return index ?? 0;
124128
}

MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Row.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ public int Index
123123
{
124124
if (!index.HasValue)
125125
{
126-
Rows rws = this.parent as Rows;
127-
SetValue("Index", index = rws.IndexOf(this));
126+
Rows rws = (Rows)parent;
127+
// One for all and all for one.
128+
for (int i = 0; i < rws.Count; ++i)
129+
{
130+
rws[i].index = i;
131+
}
128132
}
129133
return index ?? 0;
130134
}

0 commit comments

Comments
 (0)