📄 paragraphs.html
字号:
Paragraphs paragraphs = range.getParagraphs(); Styles styles = doc.getStyles(); Style style = styles.getStyle("标题 1"); paragraphs.formatStyle(style); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当样式属性值为空
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定区域中存在保护区域<DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/styles/Style.html" title="application.workbooks.workbook.documents.document.styles 中的类"><CODE>Style</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getCount()"><!-- --></A><H3>
getCount</H3>
<PRE>
public int <B>getCount</B>()</PRE>
<DL>
<DD>获得段落的数目。说明:如果这个段落集合是从章节的某个区域获得的,则返回当前章节所在的所有段落个数。 如果段落集合是从某个选取区域获得的,则返回选取区域所含段落的个数。
<P>
<DD><DL>
<DT><B>返回:</B><DD>段落的数目。 <p> <b>例子:</b> <pre> 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(); System.out.println("当前正文的段落总数是:"+paragraphs.getCount()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getFirst()"><!-- --></A><H3>
getFirst</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/paragraphs/Paragraph.html" title="application.workbooks.workbook.documents.document.paragraphs 中的类">Paragraph</A> <B>getFirst</B>()</PRE>
<DL>
<DD>获得首段落。说明:如果这个段落集合是从章节的某个区域获得的,则返回当前章节的首段落。 如果段落集合是从某个选取区域获得的,则返回选取区域的首段落。
<P>
<DD><DL>
<DT><B>返回:</B><DD>首段落。 <p> <b>例子:</b> <pre> 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.getRange().getText()); System.out.println("首段落的索引是:"+paragraph.getIndex()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getLast()"><!-- --></A><H3>
getLast</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/paragraphs/Paragraph.html" title="application.workbooks.workbook.documents.document.paragraphs 中的类">Paragraph</A> <B>getLast</B>()</PRE>
<DL>
<DD>获得尾段落。说明:如果这个段落集合是从章节的某个区域获得的,则返回当前章节的尾段落。 如果段落集合是从某个选取区域获得的,则返回选取区域的尾段落。
<P>
<DD><DL>
<DT><B>返回:</B><DD>尾段落。 <p> <b>例子:</b> <pre> 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(); System.out.println("末段落的内容是:"+paragraph.getRange().getText()); System.out.println("末段落的索引是:"+paragraph.getIndex()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getParagraph(int)"><!-- --></A><H3>
getParagraph</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/paragraphs/Paragraph.html" title="application.workbooks.workbook.documents.document.paragraphs 中的类">Paragraph</A> <B>getParagraph</B>(int index)</PRE>
<DL>
<DD>根据段落索引获得段落。说明:如果这个段落集合是从章节的某个区域获得的,则段落索引从当前章节起始位置开始计算。 如果段落集合是从某个选取区域获得的,则段落索引从选取区域起始位置开始计算。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>index</CODE> - 段落索引。
<DT><B>返回:</B><DD>指定索引的段落。 <p> <b>例子:</b> <pre> 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.getParagraph(0); System.out.println("获得段落的内容是:"+paragraph.getRange().getText()); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当段落索引小于0或大于文本的最大段落索引</DL>
</DD>
</DL>
<HR>
<A NAME="increaseIndent()"><!-- --></A><H3>
increaseIndent</H3>
<PRE>
public void <B>increaseIndent</B>()</PRE>
<DL>
<DD>增加缩进。说明:如果这个段落集合是从章节的某个区域获得的,则对这个区域的所有段落增加缩进。 如果段落集合是从某个选取区域获得的,则缩进操作只对选取区域的段落有效。 <p> <b>例子:</b> <pre> 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"); TextRange range = baseText.getRange(10,15); Paragraphs paragraphs = range.getParagraphs(); paragraphs.increaseIndent(); </pre>
<P>
<DD><DL>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定区域中存在保护区域</DL>
</DD>
</DL>
<HR>
<A NAME="increaseIndent(int, int)"><!-- --></A><H3>
increaseIndent</H3>
<PRE>
public void <B>increaseIndent</B>(int paragraphStartIndex,
int paragraphEndIndex)</PRE>
<DL>
<DD>增加缩进。说明:如果这个段落集合是从章节的某个区域获得的,则指定的段落索引从当前章节起始位置开始计算。 如果段落集合是从某个选取区域获得的,则指定的段落索引从选取区域起始位置开始计算。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>paragraphStartIndex</CODE> - 起始段落的索引号<DD><CODE>paragraphEndIndex</CODE> - 结束段落的索引号 <p> <b>例子:</b> <pre> 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(); paragraphs.increaseIndent(0,1); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当起始段落小于0或结束段落大于文本的最大段落
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当起始段落索引大于结束段落索引
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定区域中存在保护区域</DL>
</DD>
</DL>
<HR>
<A NAME="insertParagraph(int, java.lang.String)"><!-- --></A><H3>
insertParagraph</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/paragraphs/Paragraph.html" title="application.workbooks.workbook.documents.document.paragraphs 中的类">Paragraph</A> <B>insertParagraph</B>(int index,
java.lang.String text)</PRE>
<DL>
<DD>在指定的段落前以指定的文本插入段落。说明:如果这个段落集合是从章节的某个区域获得的,则新段落的插入位置从当前章节起始位置开始计算。 如果段落集合是从某个选取区域获得的,则新段落的插入位置从选取区域的起始位置开始计算。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>index</CODE> - 指定的段落索引。<DD><CODE>text</CODE> - 指定的文本。
<DT><B>返回:</B><DD>插入的段落。 <p> <b>例子:</b> <pre> 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!\n"); Paragraphs paragraphs = baseText.getParagraphs(); Paragraph paragraph = paragraphs.insertParagraph(1,"增加一个新段落"); System.out.println("新增段落的内容是:"+paragraph.getRange().getText()); System.out.println("新增段落的索引是:"+paragraph.getIndex()); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当段落索引小于0或大于文本的最大段落索引
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定区域中存在保护区域</DL>
</DD>
</DL>
<HR>
<A NAME="moveDownParagraph(long, long)"><!-- --></A><H3>
moveDownParagraph</H3>
<PRE>
public void <B>moveDownParagraph</B>(long offset,
long length)</PRE>
<DL>
<DD>向下移动段落。说明:如果这个段落集合是从章节的某个区域获得的,则指定的位置从当前章节起始位置开始计算。 如果段落集合是从某个选取区域获得的,则指定的位置从选取区域起始位置开始计算。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offest</CODE> - 指定要下移段落的起始位置<DD><CODE>length</CODE> - 指定要下移段落的长度 <p> <b>例子:</b> <pre> 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -