📄 paragraph.html
字号:
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()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../../application/workbooks/workbook/style/border/BorderAttribute.html" title="application.workbooks.workbook.style.border 中的类"><CODE>BorderAttribute</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getColumn()"><!-- --></A><H3>
getColumn</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/Column.html" title="application.workbooks.workbook.documents.document 中的类">Column</A> <B>getColumn</B>()</PRE>
<DL>
<DD>获得当前段落的分栏属性。
<P>
<DD><DL>
<DT><B>返回:</B><DD>Column类,即本段落的分栏对象 <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!"); Paragraph paragraph = baseText.getParagraphs().getParagraph(1); Column column = paragraph.getColumn(); System.out.println("当前段落的分栏数是:"+ column.getCount()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../../application/workbooks/workbook/documents/document/Column.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>Column</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getDropCap()"><!-- --></A><H3>
getDropCap</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/paragraphs/DropCap.html" title="application.workbooks.workbook.documents.document.paragraphs 中的类">DropCap</A> <B>getDropCap</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(); DropCap dropcap = paragraph.getDropCap(); System.out.println("当前段落首字下沉位置为:"+dropcap.getPositionType()); System.out.println("当前段落首字下沉字体为:"+dropcap.getFontName()); System.out.println("当前段落首字下沉行数为:"+dropcap.getDropLines()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getEndOffset()"><!-- --></A><H3>
getEndOffset</H3>
<PRE>
public long <B>getEndOffset</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.getEndOffset()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getIndex()"><!-- --></A><H3>
getIndex</H3>
<PRE>
public int <B>getIndex</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.getIndex()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getLength()"><!-- --></A><H3>
getLength</H3>
<PRE>
public long <B>getLength</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.getLength()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getOutlineLevel()"><!-- --></A><H3>
getOutlineLevel</H3>
<PRE>
public int <B>getOutlineLevel</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.getOutlineLevel()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getParagraphAttribute()"><!-- --></A><H3>
getParagraphAttribute</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/style/paragraph/ParagraphAttribute.html" title="application.workbooks.workbook.style.paragraph 中的类">ParagraphAttribute</A> <B>getParagraphAttribute</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(); ParagraphAttribute paragraphAttr = paragraph.getParagraphAttribute(); System.out.println("第一个段落的属性是:"+paragraphAttr); System.out.println("第一个段落的对齐属性是:"+paragraphAttr.getAlignment()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getRange()"><!-- --></A><H3>
getRange</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A> <B>getRange</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(); TextRange range = paragraph.getRange(); System.out.println("第一个段落的内容是:"+range.getText()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getRange(long, long)"><!-- --></A><H3>
getRange</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A> <B>getRange</B>(long start,
long end)</PRE>
<DL>
<DD>获得从当前段落起始位置算起指定范围的文本区域。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>start</CODE> - 指定范围的起始位置<DD><CODE>end</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.getFirst(); TextRange range = paragraph.getRange(5,10); System.out.println("指定范围的内容是:"+range.getText()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getShadingAttribute()"><!-- --></A><H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -