概述 | 软件包 | 类 | 树 | 索引 | 帮助

上一个类 下一个类 | 框架 无框架
摘要： 嵌套 | 字段 | 构造函数 | 方法 | 详细信息： 字段 | 构造函数 | 方法

## application.workbooks.workbook.documents.document.paragraphs
类 Paragraph

    java.lang.Object
      application.workbooks.workbook.documents.document.paragraphs.Paragraph

    public class Paragraph

extends java.lang.Object

该类为一个段落对象，提供了段落中常用的操作，如格式化段落属性，得到段落位置等。

方法摘要
`void` | `autoFormat()` 对当前段落执行自动格式化(脚注尾注没有此功能)。
`void` | `changeCase(int type)` 对当前段落的字符串更改大小写。
`void` | `clearFormats()` 清除当前段落的格式。
`void` | `formatStyle(Style style, boolean replace)` 对当前段落格式化其样式。
`BorderAttribute` | `getBorderAttribute()` 得到当前段落边框属性。
`Column` | `getColumn()` 获得当前段落的分栏属性。
`DropCap` | `getDropCap()` 得到首字下沉属性管理器。
`long` | `getEndOffset()` 获得段落的终止位置，该位置为段落在全文中的位置。
`int` | `getIndex()` 返回段落在当前文本区域中的索引。
`long` | `getLength()` 获得段落的长度。
`int` | `getOutlineLevel()` 获得当前段落的大纲级别
`ParagraphAttribute` | `getParagraphAttribute()` 获得段落属性。
`TextRange` | `getRange()` 获得段落的区域。
`TextRange` | `getRange(long start, long end)` 获得从当前段落起始位置算起指定范围的文本区域。
`ShadingAttribute` | `getShadingAttribute()` 获得当前段落的底纹属性。
`long` | `getStartoffset()` 获得段落的起始位置，该位置为段落在全文中的位置。
`TabStops` | `getTabStops()` 返回制表位的集合。
`java.lang.String` | `getText()` 获得段落的文本内容。
`Paragraph` | `nextParagraph()` 得到当前段落的下一个段落。
`Paragraph` | `previousParagraph()` 得到当前段落的上一个段落。
`void` | `setBorderAttribute(BorderAttribute borderAttribute)` 对当前段落设置段落边框。
`void` | `setColumn(Column column)` 设置当前段落的分栏属性。
`void` | `setDropCap(DropCap dropCap)` 给当前段落设置首字下沉属性。
`void` | `setFontAttribute(FontAttribute fontAttribute)` 对当前段落的字符串进行格式化字体（默认情况下替换原先的属性）。
`void` | `setFontAttribute(FontAttribute fontAttribute, boolean replace)` 对当前段落的字符串进行格式化字体。
`void` | `setOutlineLevel(int level)` 设置当前段落的大纲级别
`void` | `setParagraphAttribute(ParagraphAttribute paragraphAttribute)` 对当前段落进行段落格式化（默认情况下替换原先的属性）。
`void` | `setParagraphAttribute(ParagraphAttribute paragraphAttribute, boolean replace)` 对当前段落进行段落格式化。
`void` | `setShadingAttribute(ShadingAttribute shadingAttribute)` 对当前段落设置段落底纹。
`void` | `tcscConverter(boolean sctc)` 对当前段落进行简繁体转换。

从类 java.lang.Object 继承的方法
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

方法详细信息

### autoFormat

    public void autoFormat()

  对当前段落执行自动格式化(脚注尾注没有此功能)。

  使用前可以先调用 application.workbooks.workbook.autotext.AutoFormat中的静态方法进行设置Flag

  例子:

       Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
       Section section = doc.getSection(0);
       BaseText baseText = section.getBaseText();
       baseText.insertText(0,"replace fraction test 1/2 \ntest end");
       Paragraphs paragraphs = baseText.getParagraphs();
       Paragraph paragraph = paragraphs.getFirst();
       AutoFormat.setReplaceFractionFlag(true);
       paragraph.autoFormat();

  抛出：
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `AutoFormat`

### changeCase

    public void changeCase(int type)

  对当前段落的字符串更改大小写。

  参数：
    `type` - 更改大小写的类型。只能取以下值之一：

         ChangeCaseConstants.SENTENCECASE    表示句首字母大写
         ChangeCaseConstants.LOWERCASE       表示小写
         ChangeCaseConstants.UPPERCASE       表示大写
         ChangeCaseConstants.TITLECASE       表示词首字母大写
         ChangeCaseConstants.TOGGLECASE      对所选内容进行大小写转换，即大写字母转换为小写，小写字母转换为大写

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         paragraph.changeCase(ChangeCaseConstants.UPPERCASE);

  抛出：
    `MacroRunException` - 当指定区域中存在保护区域
    `MacroRunException` - 当前段落的字符串更改大小写的常量不存在
  另请参见：
    `ChangeCaseConstants`

### clearFormats

    public void clearFormats()

  清除当前段落的格式。

  例子:

       Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
       Section section = doc.getSection(0);
       BaseText baseText = section.getBaseText();
       baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
       Paragraphs paragraphs = baseText.getParagraphs();
       Paragraph paragraph = paragraphs.getFirst();
       paragraph.clearFormats();

  抛出：
    `MacroRunException` - 当指定区域中存在保护区域

### formatStyle

    public void formatStyle(Style style,
                            boolean replace)

  对当前段落格式化其样式。

  参数：
    `style` - 样式属性
    `replace` - 布尔型值，是否替换原先属性。如果为true，表示替换原先的属性；否则，表示不替换原先属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         Styles styles = doc.getStyles();
         Style style = styles.getStyle("标题 1");
         paragraph.formatStyle(style,false);

  抛出：
    `MacroRunException` - 当样式属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `Style`

### getBorderAttribute

    public BorderAttribute getBorderAttribute()

  得到当前段落边框属性。

  返回：
    边框属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         BorderAttribute borderAttr = new BorderAttribute();
         borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX);
         borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,0.75f);
         paragraph.setBorderAttribute(borderAttr);
         borderAttr = paragraph.getBorderAttribute();
         System.out.println("获得边框属性的边框类型为：" + borderAttr.getBorderType());

  另请参见：
    `BorderAttribute`

### getColumn

    public Column getColumn()

  获得当前段落的分栏属性。

  返回：
    Column类，即本段落的分栏对象

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test!\nthis is a test!\nthis is a test!");
         Paragraph paragraph = baseText.getParagraphs().getParagraph(1);
         Column column = paragraph.getColumn();
         System.out.println("当前段落的分栏数是："+ column.getCount());

  另请参见：
    `Column`

### getDropCap

    public DropCap getDropCap()

  得到首字下沉属性管理器。说明：每个段落仅有一个首字下沉管理器。

  返回：
    首字下沉属性管理器

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         DropCap dropcap = paragraph.getDropCap();
         System.out.println("当前段落首字下沉位置为："+dropcap.getPositionType());
         System.out.println("当前段落首字下沉字体为："+dropcap.getFontName());
         System.out.println("当前段落首字下沉行数为："+dropcap.getDropLines());

### getEndOffset

    public long getEndOffset()

  获得段落的终止位置，该位置为段落在全文中的位置。

  返回：
    段落的终止位置。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的结束位置是："+paragraph.getEndOffset());

### getIndex

    public int getIndex()

  返回段落在当前文本区域中的索引。

  返回：
    段落在当前文本区域的索引

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的索引是："+paragraph.getIndex());

### getLength

    public long getLength()

  获得段落的长度。

  返回：
    段落的长度

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的长度是："+paragraph.getLength());

### getOutlineLevel

    public int getOutlineLevel()

  获得当前段落的大纲级别

  返回：
    段落的大纲级别

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的大纲级别是："+paragraph.getOutlineLevel());

### getParagraphAttribute

    public ParagraphAttribute getParagraphAttribute()

  获得段落属性。

  返回：
    段落属性。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         ParagraphAttribute paragraphAttr = paragraph.getParagraphAttribute();
         System.out.println("第一个段落的属性是："+paragraphAttr);
         System.out.println("第一个段落的对齐属性是："+paragraphAttr.getAlignment());

### getRange

    public TextRange getRange()

  获得段落的区域。

  返回：
    段落的区域。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         TextRange range = paragraph.getRange();
         System.out.println("第一个段落的内容是："+range.getText());

### getRange

    public TextRange getRange(long start,
                              long end)

  获得从当前段落起始位置算起指定范围的文本区域。

  参数：
    `start` - 指定范围的起始位置
    `end` - 指定范围的结束位置
  返回：
    动态文本区域。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         TextRange range = paragraph.getRange(5,10);
         System.out.println("指定范围的内容是："+range.getText());

### getShadingAttribute

    public ShadingAttribute getShadingAttribute()

  获得当前段落的底纹属性。

  返回：
    底纹属性。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test!\nthis is a test!\nthis is a test!");
         Paragraph paragraph = baseText.getParagraphs().getFirst();
         ShadingAttribute shadingAttr = new ShadingAttribute();
         shadingAttr.setTextureIndex(8);
         paragraph.setShadingAttribute(shadingAttr);
         shadingAttr = paragraph.getShadingAttribute();
         System.out.println("获得底纹属性的纹理索引为：" + shadingAttr.getTextureIndex());

  另请参见：
    `ShadingAttribute`

### getStartoffset

    public long getStartoffset()

  获得段落的起始位置，该位置为段落在全文中的位置。

  返回：
    段落的起始位置。

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的起始位置是："+paragraph.getStartoffset());

### getTabStops

    public TabStops getTabStops()

  返回制表位的集合。

  返回：
    TabStops类，用于管理制表位

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         TabStops tabstops = paragraph.getTabStops();
         System.out.println("第一个段落的制表位集为："+tabstops);

  另请参见：
    `application.workbooks.workbook.documents.document.tabstops`, `TabStop`

### getText

    public java.lang.String getText()

  获得段落的文本内容。

  返回：
    段落的文本内容

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         System.out.println("第一个段落的内容是："+paragraph.getText());

### nextParagraph

    public Paragraph nextParagraph()

  得到当前段落的下一个段落。说明：如果当前段落是在页眉、页脚，那就只能在当前文本区域中查找段落，找不到则返回Null。

  返回：
    返回下一个段落

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         Paragraph nextParagraph = paragraph.nextParagraph();
         System.out.println("下一个段落的内容为："+nextParagraph.getRange().getText());

### previousParagraph

    public Paragraph previousParagraph()

  得到当前段落的上一个段落。说明：如果当前段落是在页眉、页脚中，那就只能在当前文本区域中查找段落，找不到则返回Null。

  返回：
    返回上一个段落

    例子：

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getLast();
         Paragraph preParagraph = paragraph.previousParagraph();
         System.out.println("上一个段落的内容为："+preParagraph.getRange().getText());

### setBorderAttribute

    public void setBorderAttribute(BorderAttribute borderAttribute)

  对当前段落设置段落边框。

  参数：
    `baseBorderAttribute` - 要设置的边框属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         BorderAttribute borderAttr = new BorderAttribute();
         borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX);
         borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,0.75f);
         borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,0);
         borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,new java.awt.Color(255,0,0));
         borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,0.75f);
         paragraph.setBorderAttribute(borderAttr);

  抛出：
    `MacroRunException` - 当边框属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `BorderAttribute`

### setColumn

    public void setColumn(Column column)

  设置当前段落的分栏属性。

  参数：
    `column` - 分栏对象

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test!\nthis is a test!\nthis is a test!");
         Paragraph paragraph = baseText.getParagraphs().getParagraph(1);
         Column column = section.getColumn();
         column.setCount(3);
         column.setEqualsWidth(false);
         column.setWidth(0, 100.0f);
         column.setWidth(1, 200.0f);
         column.setWidth(2, 100.0f);
         paragraph.setColumn(column);

  抛出：
    `MacroRunException` - 当指定区域中存在保护区域

### setDropCap

    public void setDropCap(DropCap dropCap)

  给当前段落设置首字下沉属性。

  参数：
    `dropCap` - 首字下沉属性管理器

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         DropCap dropcap = paragraph.getDropCap();
         dropcap.setPositionType(ParagraphConstants.POSITION_SUSPEND);
         dropcap.setDropLines(4);
         paragraph.setDropCap(dropcap);

### setFontAttribute

    public void setFontAttribute(FontAttribute fontAttribute)

  对当前段落的字符串进行格式化字体（默认情况下替换原先的属性）。

  参数：
    `fontAttribute` - 字体属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         FontAttribute fontAttr = new FontAttribute();
         fontAttr.setFontSize(18.0);
         fontAttr.setBold(true);
         paragraph.setFontAttribute(fontAttr);

  抛出：
    `MacroRunException` - 当字体属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `FontAttribute`

### setFontAttribute

    public void setFontAttribute(FontAttribute fontAttribute,
                                 boolean replace)

  对当前段落的字符串进行格式化字体。

  参数：
    `fontAttribute` - 字体属性
    `replace` - 布尔型值，如果为true，表示替换原先的属性；否则，表示保留原先属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         FontAttribute fontAttr = new FontAttribute();
         fontAttr.setFontSize(18.0);
         fontAttr.setBold(true);
         paragraph.setFontAttribute(fontAttr);

  抛出：
    `MacroRunException` - 当字体属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `FontAttribute`

### setOutlineLevel

    public void setOutlineLevel(int level)

  设置当前段落的大纲级别

  参数：
    `level` - 段落的大纲级别

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         paragraph.setOutlineLevel(OutlineLevelConstants.OUT_LINE_LEVEL3);

  抛出：
    `MacroRunException` - 文档被保护或指定的位置被保护
    `MacroRunException` - 当段落的大纲级别常量不存在
  另请参见：
    `OutlineLevelConstants`

### setParagraphAttribute

    public void setParagraphAttribute(ParagraphAttribute paragraphAttribute)

  对当前段落进行段落格式化（默认情况下替换原先的属性）。

  参数：
    `paragraphAttribute` - 格式化字符的段落属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         ParagraphAttribute paragraphAttr = new ParagraphAttribute();
         paragraphAttr.setAlignment(ParagraphConstants.ALIGNMENT_CENTER);
         paragraph.setParagraphAttribute(paragraphAttr);

  抛出：
    `MacroRunException` - 当段落属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `ParagraphAttribute`

### setParagraphAttribute

    public void setParagraphAttribute(ParagraphAttribute paragraphAttribute,
                                      boolean replace)

  对当前段落进行段落格式化。

  参数：
    `paragraphAttribute` - 格式化字符的段落属性
    `replace` - 布尔型值，表示是否替换原先的属性。true表示替换原先的属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         ParagraphAttribute paragraphAttr = new ParagraphAttribute();
         paragraphAttr.setAlignment(ParagraphConstants.ALIGNMENT_CENTER);
         paragraph.setParagraphAttribute(paragraphAttr,false);

  抛出：
    `MacroRunException` - 当段落属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `ParagraphAttribute`

### setShadingAttribute

    public void setShadingAttribute(ShadingAttribute shadingAttribute)

  对当前段落设置段落底纹。

  参数：
    `shadingAttribute` - 要设置的底纹属性

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"this is a test1!\nthis is a test2!\nthis is a test3!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         ShadingAttribute shadingAttr = baseText.getShadingAttribute(0);
         shadingAttr.setTextureIndex(8);
         paragraph.setShadingAttribute(shadingAttr);

  抛出：
    `MacroRunException` - 当底纹属性值为空
    `MacroRunException` - 当指定区域中存在保护区域
  另请参见：
    `ShadingAttribute`

### tcscConverter

    public void tcscConverter(boolean sctc)

  对当前段落进行简繁体转换。

  参数：
    `sctc` - 布尔型值，如果为true，则表示简体转换到繁体；否则，表示繁体转换到简体

    例子:

         Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument();
         Section section = doc.getSection(0);
         BaseText baseText = section.getBaseText();
         baseText.insertText(0,"中华人民共和国!\n中华人民共和国!\n中华人民共和国!\n");
         Paragraphs paragraphs = baseText.getParagraphs();
         Paragraph paragraph = paragraphs.getFirst();
         paragraph.tcscConverter(true);

  抛出：
    `MacroRunException` - 当指定区域中存在保护区域

概述 | 软件包 | 类 | 树 | 索引 | 帮助

上一个类 下一个类 | 框架 无框架
摘要： 嵌套 | 字段 | 构造函数 | 方法 | 详细信息： 字段 | 构造函数 | 方法

版权所有 2001-2008 无锡永中科技有限公司