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


C# Range.GetParagraph方法代码示例

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


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

示例1: assertLevels

 private void assertLevels(Range documentRange, StyleSheet styleSheet, int parIndex, int expectedStyleLvl, int expectedParLvl)
 {
     Paragraph par = documentRange.GetParagraph(parIndex);
     Assert.AreEqual(expectedStyleLvl, styleSheet.GetParagraphStyle(par.GetStyleIndex()).GetLvl());
     Assert.AreEqual(expectedParLvl, par.GetLvl());
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:6,代码来源:TestBugs.cs

示例2: GetParagraphText

        public static String[] GetParagraphText(Range r)
        {
            String[] ret;
            ret = new String[r.NumParagraphs];
            for (int i = 0; i < ret.Length; i++)
            {
                Paragraph p = r.GetParagraph(i);
                ret[i] = p.Text;

                // Fix the line ending
                if (ret[i].EndsWith("\r"))
                {
                    ret[i] = ret[i] + "\n";
                }
            }
            return ret;
        }
开发者ID:89sos98,项目名称:npoi,代码行数:17,代码来源:WordExtractor.cs

示例3: Test

        public void Test()
        {
            HWPFDocument doc = HWPFTestDataSamples.OpenSampleFile("Bug49919.doc");
            range = doc.GetRange();

            Paragraph par = FindParagraph("Paragraph normal\r");
            Assert.AreEqual(0, par.GetLeftBorder().BorderType);
            Assert.AreEqual(0, par.GetRightBorder().BorderType);
            Assert.AreEqual(0, par.GetTopBorder().BorderType);
            Assert.AreEqual(0, par.GetBottomBorder().BorderType);

            par = FindParagraph("Paragraph with border\r");
            Assert.AreEqual(18, par.GetLeftBorder().BorderType);
            Assert.AreEqual(17, par.GetRightBorder().BorderType);
            Assert.AreEqual(18, par.GetTopBorder().BorderType);
            Assert.AreEqual(17, par.GetBottomBorder().BorderType);
            Assert.AreEqual(15, par.GetLeftBorder().Color);

            par = FindParagraph("Paragraph with red border\r");
            Assert.AreEqual(1, par.GetLeftBorder().BorderType);
            Assert.AreEqual(1, par.GetRightBorder().BorderType);
            Assert.AreEqual(1, par.GetTopBorder().BorderType);
            Assert.AreEqual(1, par.GetBottomBorder().BorderType);
            Assert.AreEqual(6, par.GetLeftBorder().Color);

            par = FindParagraph("Paragraph with bordered words.\r");
            Assert.AreEqual(0, par.GetLeftBorder().BorderType);
            Assert.AreEqual(0, par.GetRightBorder().BorderType);
            Assert.AreEqual(0, par.GetTopBorder().BorderType);
            Assert.AreEqual(0, par.GetBottomBorder().BorderType);

            Assert.AreEqual(3, par.NumCharacterRuns);
            CharacterRun chr = par.GetCharacterRun(0);
            Assert.AreEqual(0, chr.GetBorder().BorderType);
            chr = par.GetCharacterRun(1);
            Assert.AreEqual(1, chr.GetBorder().BorderType);
            Assert.AreEqual(0, chr.GetBorder().Color);
            chr = par.GetCharacterRun(2);
            Assert.AreEqual(0, chr.GetBorder().BorderType);

            while (pos < range.NumParagraphs - 1)
            {
                par = range.GetParagraph(pos++);
                if (par.IsInTable())
                    break;
            }

            Assert.AreEqual(true, par.IsInTable());
            Table tab = range.GetTable(par);

            // Border could be defined for the entire row, or for each cell, with the same visual appearance.
            Assert.AreEqual(2, tab.NumRows);
            TableRow row = tab.GetRow(0);
            Assert.AreEqual(1, row.GetLeftBorder().BorderType);
            Assert.AreEqual(1, row.GetRightBorder().BorderType);
            Assert.AreEqual(1, row.GetTopBorder().BorderType);
            Assert.AreEqual(1, row.GetBottomBorder().BorderType);

            Assert.AreEqual(2, row.NumCells());
            TableCell cell = row.GetCell(1);
            Assert.AreEqual(3, cell.GetBrcTop().BorderType);

            row = tab.GetRow(1);
            cell = row.GetCell(0);
            // 255 Clears border inherited from row
            Assert.AreEqual(255, cell.GetBrcBottom().BorderType);
        }
开发者ID:89sos98,项目名称:npoi,代码行数:67,代码来源:TestBorderCode.cs


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