當前位置: 首頁>>代碼示例>>C#>>正文


C# DocumentNode.GetTableRows方法代碼示例

本文整理匯總了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++;
                    }
                }
 
//.........這裏部分代碼省略.........
開發者ID:sjyanxin,項目名稱:WPFSource,代碼行數:101,代碼來源:XamlToRtfWriter.cs


注:本文中的System.Windows.Documents.DocumentNode.GetTableRows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。