⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textrange.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<PRE>
public void <B>clearFormats</B>()</PRE>
<DL>
<DD>清除当前区域的属性(包括字体、段落等属性)。 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FontAttribute fontAttr = new FontAttribute(); fontAttr.setBold(true); baseText.insertText(0,"this is a test!\nthis is a test!\nthis is a test!",fontAttr); ParagraphAttribute paraAttr = new ParagraphAttribute(); paraAttr.setAlignment(ParagraphConstants.ALIGNMENT_CENTER); baseText.setParagraphAttribute(0, baseText.getTextLength()-1, paraAttr,false); TextRange range = baseText.getRange(3,10); range.clearFormats(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="collapse(int)"><!-- --></A><H3>
collapse</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A> <B>collapse</B>(int&nbsp;direction)</PRE>
<DL>
<DD>将某一区域或所选内容折叠到起始位置或结束位置。折叠之后起始位置和结束位置相同。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>direction</CODE> - 代表折叠某区域或所选内容的方向。可以取0或者1。 <pre> 0:代表折叠某区域或所选内容的开头 1:代表折叠某区域或所选内容的末尾 </pre>
<DT><B>返回:</B><DD>返回折叠后的文本范围对象 <p> <b>例子:</b> 以下示例定义一个文本范围对象,范围相对当前正文起始位置为2,终止位置为4。然后再将这个范围进行折叠到原范围的末尾。 <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!"); TextRange range = baseText.getRange(2,4); range = range.collapse(1); System.out.println("返回新指定文本区域的内容:"+range.getText()); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定折叠的方向常量不存在</DL>
</DD>
</DL>
<HR>

<A NAME="copy()"><!-- --></A><H3>
copy</H3>
<PRE>
public void <B>copy</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 test!\nthis is a test!\nthis is a test!"); TextRange range = baseText.getRange(2,4); range.copy(); range.paste(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="copyFormat()"><!-- --></A><H3>
copyFormat</H3>
<PRE>
public void <B>copyFormat</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 test!\nthis is a test!\nthis is a test!"); FontAttribute fontAttr = new FontAttribute(); fontAttr.setForeground(java.awt.Color.red); baseText.setFontAttribute(0,15,fontAttr); TextRange range = baseText.getRange(2,6); range.copyFormat(); range = range.moveStart(5); range.pasteFormat(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="cut()"><!-- --></A><H3>
cut</H3>
<PRE>
public void <B>cut</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 test!\nthis is a test!\nthis is a test!"); TextRange range = baseText.getRange(2,4); range.cut(); range.paste(0); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="decreaseIndent()"><!-- --></A><H3>
decreaseIndent</H3>
<PRE>
public void <B>decreaseIndent</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 test!\nthis is a test!\nthis is a test!"); TextRange range = baseText.getRange(2,10); range.decreaseIndent(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="delete()"><!-- --></A><H3>
delete</H3>
<PRE>
public void <B>delete</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 test!\nthis is a test!\nthis is a test!"); TextRange range = baseText.getRange(2,4); range.delete(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="deleteHyperlink()"><!-- --></A><H3>
deleteHyperlink</H3>
<PRE>
public void <B>deleteHyperlink</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 test!\nthis is a test!\nthis is a test!"); Hyperlink hyperlink = new Hyperlink(); hyperlink.setHyperlinkType(HyperlinkConstants.THIS_BINDER_POSITION); hyperlink.setShowText("this is a test!"); hyperlink.hyperlinkToCell("工作表1!A1"); baseText.insertHyperlink(3,6,hyperlink); TextRange range = baseText.getRange(4,10); range.deleteHyperlink(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="expandToSimilarFormat()"><!-- --></A><H3>
expandToSimilarFormat</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A>[] <B>expandToSimilarFormat</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 test!\nthis is a test!"); TextRange range=doc.getRange(0,5); range.expandToSimilarFormat(); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="formatStyle(application.workbooks.workbook.documents.document.styles.Style)"><!-- --></A><H3>
formatStyle</H3>
<PRE>
public void <B>formatStyle</B>(<A HREF="../../../../../application/workbooks/workbook/documents/do

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -