本文整理汇总了C#中System.Windows.Documents.DocumentNode.GetTableRows方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentNode.GetTableRows方法的具体用法?C# DocumentNode.GetTableRows怎么用?C# DocumentNode.GetTableRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.DocumentNode
的用法示例。
在下文中一共展示了DocumentNode.GetTableRows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PatchVerticallyMergedCells
private void PatchVerticallyMergedCells(DocumentNode dnThis)
{
DocumentNodeArray dna = _converterState.DocumentNodeArray;
DocumentNodeArray dnaRows = dnThis.GetTableRows();
DocumentNodeArray dnaSpanCells = new DocumentNodeArray();
ArrayList spanCounts = new ArrayList();
int nCol = 0;
int nColExtra = 0;
for (int i = 0; i < dnaRows.Count; i++)
{
DocumentNode dnRow = dnaRows.EntryAt(i);
DocumentNodeArray dnaCells = dnRow.GetRowsCells();
int nColHere = 0;
for (int j = 0; j < dnaCells.Count; j++)
{
DocumentNode dnCell = dnaCells.EntryAt(j);
// Insert vmerged cell placeholder if necessary
nColExtra = nColHere;
while (nColExtra < spanCounts.Count && ((int)spanCounts[nColExtra]) > 0)
{
DocumentNode dnSpanningCell = dnaSpanCells.EntryAt(nColExtra);
DocumentNode dnNew = new DocumentNode(DocumentNodeType.dnCell);
dna.InsertChildAt(dnRow, dnNew, dnCell.Index, 0);
dnNew.FormatState = new FormatState(dnSpanningCell.FormatState);
if (dnSpanningCell.FormatState.HasRowFormat)
{
dnNew.FormatState.RowFormat = new RowFormat(dnSpanningCell.FormatState.RowFormat);
}
dnNew.FormatState.RowFormat.RowCellFormat.IsVMergeFirst = false;
dnNew.FormatState.RowFormat.RowCellFormat.IsVMerge = true;
dnNew.ColSpan = dnSpanningCell.ColSpan;
nColExtra += dnNew.ColSpan;
}
// Take care of any cells hanging down from above.
while (nColHere < spanCounts.Count && ((int)spanCounts[nColHere]) > 0)
{
// Update span count for this row
spanCounts[nColHere] = ((int)spanCounts[nColHere]) - 1;
if ((int)spanCounts[nColHere] == 0)
{
dnaSpanCells[nColHere] = null;
}
nColHere++;
}
// Now update colHere and spanCounts
for (int k = 0; k < dnCell.ColSpan; k++)
{
if (nColHere < spanCounts.Count)
{
spanCounts[nColHere] = dnCell.RowSpan - 1;
dnaSpanCells[nColHere] = (dnCell.RowSpan > 1) ? dnCell : null;
}
else
{
spanCounts.Add(dnCell.RowSpan - 1);
dnaSpanCells.Add((dnCell.RowSpan > 1) ? dnCell : null);
}
nColHere++;
}
// Mark this cell as first in vmerged list if necessary
if (dnCell.RowSpan > 1)
{
CellFormat cf = dnCell.FormatState.RowFormat.RowCellFormat;
cf.IsVMergeFirst = true;
}
}
// Insert vmerged cell placeholder if necessary
nColExtra = nColHere;
while (nColExtra < spanCounts.Count)
{
if (((int)spanCounts[nColExtra]) > 0)
{
// Insert vmerged cell here.
DocumentNode dnSpanningCell = dnaSpanCells.EntryAt(nColExtra);
DocumentNode dnNew = new DocumentNode(DocumentNodeType.dnCell);
dna.InsertChildAt(dnRow, dnNew, dnRow.Index + dnRow.ChildCount + 1, 0);
dnNew.FormatState = new FormatState(dnSpanningCell.FormatState);
if (dnSpanningCell.FormatState.HasRowFormat)
{
dnNew.FormatState.RowFormat = new RowFormat(dnSpanningCell.FormatState.RowFormat);
}
dnNew.FormatState.RowFormat.RowCellFormat.IsVMergeFirst = false;
dnNew.FormatState.RowFormat.RowCellFormat.IsVMerge = true;
dnNew.ColSpan = dnSpanningCell.ColSpan;
nColExtra += dnNew.ColSpan;
}
else
{
nColExtra++;
}
}
//.........这里部分代码省略.........