当前位置: 首页>>代码示例>>C#>>正文


C# DocumentNode.GetRowsCells方法代码示例

本文整理汇总了C#中System.Windows.Documents.DocumentNode.GetRowsCells方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentNode.GetRowsCells方法的具体用法?C# DocumentNode.GetRowsCells怎么用?C# DocumentNode.GetRowsCells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Documents.DocumentNode的用法示例。


在下文中一共展示了DocumentNode.GetRowsCells方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PreCoalesceRow

        private void PreCoalesceRow(DocumentNode dn, ref bool fVMerged)
        {
            DocumentNodeArray dnaCells = dn.GetRowsCells();
            RowFormat rf = dn.FormatState.RowFormat;
            DocumentNode dnTable = dn.GetParentOfType(DocumentNodeType.dnTable);
            ColumnStateArray csa = (dnTable != null) ? dnTable.ColumnStateArray : null;

            // Normally number of cells and cell definitions are equal, but be careful.
            int nCount = dnaCells.Count < rf.CellCount ? dnaCells.Count : rf.CellCount;

            // Non-unary colspan can arise both because I have "merged" cells specified
            // as well as because I just have cells that exactly span some other cols.
            // The code in PreCoalesce enforces that the cells line up, so I can just
            // test for that here.

            int nColsSeen = 0;
            int i = 0;
            while (i < nCount)
            {
                DocumentNode dnCell = dnaCells.EntryAt(i);
                CellFormat cf = rf.NthCellFormat(i);
                long cellx = cf.CellX;

                // optimization - record if we encountered a vmerged cell
                if (cf.IsVMerge)
                {
                    fVMerged = true;
                }

                // Determine colspan based on cells we will eliminate through the merge flags
                if (cf.IsHMergeFirst)
                {
                    for (i++; i < nCount; i++)
                    {
                        cf = rf.NthCellFormat(i);
                        if (cf.IsVMerge)
                        {
                            fVMerged = true;
                        }
                        if (cf.IsHMerge)
                        {
                            dnaCells.EntryAt(i).ColSpan = 0;    // zero means omit this cell
                        }
                    }
                }
                else
                {
                    i++;
                }

                // Determine actual colspan based on cellx value
                if (csa != null)
                {
                    int nColStart = nColsSeen;

                    while (nColsSeen < csa.Count)
                    {
                        ColumnState cs = csa.EntryAt(nColsSeen);
                        nColsSeen++;

                        // This is the normal case
                        if (cs.CellX == cellx)
                        {
                            break;
                        }

                        // This is anomalous, but can occur with odd \cellx values (non-monotonically increasing).
                        if (cs.CellX > cellx)
                        {
                            break;
                        }
                    }

                    if (nColsSeen - nColStart > dnCell.ColSpan)
                    {
                        dnCell.ColSpan = nColsSeen - nColStart;
                    }
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:80,代码来源:RtfToXamlReader.cs

示例2: WriteRowsCellProperties

        private void WriteRowsCellProperties(DocumentNode dnRow) 
        {
            DocumentNodeArray cellArray = dnRow.GetRowsCells(); 

            int nCol = 0;
            long lastCellX = 0;
 
            for (int i = 0; i < cellArray.Count; i++)
            { 
                DocumentNode dnCell = cellArray.EntryAt(i); 

                lastCellX = WriteCellProperties(dnCell, nCol, lastCellX); 
                nCol += dnCell.ColSpan;
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:15,代码来源:XamlToRtfWriter.cs

示例3: WriteRowsCellContents

        private void WriteRowsCellContents(DocumentNode dnRow)
        { 
            DocumentNodeArray cellArray = dnRow.GetRowsCells(); 

            _rtfBuilder.Append("{"); 
            for (int i = 0; i < cellArray.Count; i++)
            {
                DocumentNode dnCell = cellArray.EntryAt(i);
 
                WriteStructure(dnCell);
            } 
            _rtfBuilder.Append("}"); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:13,代码来源:XamlToRtfWriter.cs

示例4: WriteRowBorders

        private void WriteRowBorders(DocumentNode dnRow) 
        {
            // XAML doesn't have notion of default row borders, so there is no explicit attribute
            // in the XAML content to use here and in fact we will always override these values with
            // explicit cell border properties. 
            // However, so they are not nonsensical, pick the first cell's properties to write out and if
            // borders are uniform for the row, this will actually be accurate. 
            DocumentNodeArray cellArray = dnRow.GetRowsCells(); 
            if (cellArray.Count > 0)
            { 
                DocumentNode dnCell = cellArray.EntryAt(0);
                if (dnCell.FormatState.HasRowFormat)
                {
                    CellFormat cf = dnCell.FormatState.RowFormat.RowCellFormat; 

                    WriteBorder("\\trbrdrt", cf.BorderTop); 
                    WriteBorder("\\trbrdrb", cf.BorderBottom); 
                    WriteBorder("\\trbrdrr", cf.BorderRight);
                    WriteBorder("\\trbrdrl", cf.BorderLeft); 
                    WriteBorder("\\trbrdrv", cf.BorderLeft);
                    WriteBorder("\\trbrdrh", cf.BorderTop);
                }
            } 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:24,代码来源:XamlToRtfWriter.cs


注:本文中的System.Windows.Documents.DocumentNode.GetRowsCells方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。