本文整理汇总了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());
}
示例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;
}
示例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);
}