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

📄 findreplace.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<DD><DL>

<DT><B>返回:</B><DD>布尔型值,如果查找时整个单词匹配,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("office EIO"); finding.setForward(true); finding.setMatchWholeWord(true); baseText.find(finding); boolean isMatchWholeWord = finding.getMatchWholeWord(); System.out.println("查找过程中查找的单词是否需要完全匹配:" + isMatchWholeWord); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setMatchWholeWord(boolean)"><CODE>setMatchWholeWord(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getMatchWildcards()"><!-- --></A><H3>
getMatchWildcards</H3>
<PRE>
public boolean <B>getMatchWildcards</B>()</PRE>
<DL>
<DD>判断查找过程中查找的单词是否可以使用通配符。
<P>
<DD><DL>

<DT><B>返回:</B><DD>布尔型值,如果查找过程中可以使用通配符,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("*eio"); finding.setForward(true); finding.setMatchWildcards(true); baseText.find(finding); boolean isMatchWildcards = finding.getMatchWildcards(); System.out.println("查找过程中是否可以使用通配符:" + isMatchWildcards); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setMatchWildcards(boolean)"><CODE>setMatchWildcards(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A></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().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); ParagraphAttribute paraAttribute = new ParagraphAttribute(); paraAttribute.setAlignment(ParagraphConstants.ALIGNMENT_LEFT);  paraAttribute.setLeftIndent(5.0f);  finding.setParagraph(paraAttribute); finding.setForward(true); finding.setFormat(true); baseText.find(finding);  ParagraphAttribute  findingpara = finding.getParagraph(); System.out.println("查找或替换文本的段落对齐方式为:" + findingpara.getAlignment()); System.out.println("查找或替换文本的段落左缩进为:" + findingpara.getLeftIndent()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setParagraph(application.workbooks.workbook.style.paragraph.ParagraphAttribute)"><CODE>setParagraph(ParagraphAttribute)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setFormat(boolean)"><CODE>setFormat(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/style/paragraph/ParagraphAttribute.html" title="application.workbooks.workbook.style.paragraph 中的类"><CODE>ParagraphAttribute</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getReplacement()"><!-- --></A><H3>
getReplacement</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html" title="application.workbooks.workbook.documents.document 中的类">Replacement</A> <B>getReplacement</B>()</PRE>
<DL>
<DD>获取替换文本时的替换文本属性。 (注:不仅可以把文本内容替换掉,还可以把文本属性(字体或段落格式或样式等)替换掉。)
<P>
<DD><DL>

<DT><B>返回:</B><DD>替换文本时的替换文本属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); finding.setForward(true); finding.setFormat(true); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("office"); finding.setReplacement(replacement); baseText.replace(finding);  Replacement replace = finding.getReplacement(); System.out.println("替换文本为:" + replace.getText()); System.out.println("替换文本是否粗体:" + replace.getFont().isBold()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setReplacement(application.workbooks.workbook.documents.document.Replacement)"><CODE>setReplacement(Replacement)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setFormat(boolean)"><CODE>setFormat(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>Replacement</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getStyle()"><!-- --></A><H3>
getStyle</H3>
<PRE>
public java.lang.String <B>getStyle</B>()</PRE>
<DL>
<DD>获取查找或替换文本的样式。
<P>
<DD><DL>

<DT><B>返回:</B><DD>查找或替换文本的样式 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); finding.setStyle("标题 1"); finding.setForward(true); finding.setFormat(true); baseText.find(finding);  String style = finding.getStyle(); System.out.println("查找或替换文本的样式为:" + style); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setStyle(java.lang.String)"><CODE>setStyle(String)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setFormat(boolean)"><CODE>setFormat(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getText()"><!-- --></A><H3>
getText</H3>
<PRE>
public java.lang.String <B>getText</B>()</PRE>
<DL>
<DD>获取要查找的内容。 (注:要查找就必须初始化FindReplace类。)
<P>
<DD><DL>

<DT><B>返回:</B><DD>要查找的内容 <p> <b>例子:</b> <pre> //请输入一些文字 Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); baseText.find(finding); String findstr = find.getText(); System.out.println("要查找的内容为:" + findstr); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setText(java.lang.String)"><CODE>setText(String)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="isMatchByte()"><!-- --></A><H3>
isMatchByte</H3>
<PRE>
public boolean <B>isMatchByte</B>()</PRE>
<DL>
<DD>判断是否区分全角和半角
<P>
<DD><DL>

<DT><B>返回:</B><DD>是否区分全角和半角(true :区分,false :不区分) <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); finding.setForward(true); finding.setFormat(true); System.out.println(finding.isMatchByte()); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setFindDirect(int)"><!-- --></A><H3>
setFindDirect</H3>
<PRE>
public void <B>setFindDirect</B>(int&nbsp;findDirect)</PRE>
<DL>
<DD>设置文本查找的方式。 (注:从当前位置向下查找完后会自动跳到文本首位置继续向下查找,而从当前位置向上查找完后,查找就此结束。     要查找就必须创建FindReplace对象。)
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>findDirect</CODE> - 文本查找的方式,只能取以下值之一: <pre>                FindConstants.FORWARD   0  表示查找的方式为向下查找                FindConstants.BACKWARD  1  表示查找方式为向上查找                FindConstants.ALL       2  表示查找方式为全部查找 </pre> <p> <b>例子:</b> <pre> //请输入一些文字 Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); finding.setFindDirect(FindConstants.FORWARD); baseText.find(finding); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#getFindDirect()"><CODE>getFindDirect()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setFontAttribute(application.workbooks.workbook.style.font.FontAttribute)"><!-- --></A><H3>
setFontAttribute</H3>
<PRE>
public void <B>setFontAttribute</B>(<A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类">FontAttribute</A>&nbsp;fontAttribute)</PRE>
<DL>
<DD>设置查找或替换文本的字体格式。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>fontAttribute</CODE> - 查找或替换文本的字体格式 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); FontAttribute font = new FontAttribute(); font.setBold(true); font.setFontSize(14); finding.setFont(font); finding.setForward(true); finding.setFormat(true); baseText.find(finding);  </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setFormat(boolean)"><CODE>setFormat(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#clearFormat()"><CODE>clearFormat()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setText(java.lang.String)"><CODE>setText(String)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setParagraph(application.workbooks.workbook.style.paragraph.ParagraphAttribute)"><CODE>setParagraph(ParagraphAttribute)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#setStyle(java.lang.String)"><CODE>setStyle(String)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类"><CODE>FontAttribute</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setHighlight(int)"><!-- --></A><H3>
setHighlight</H3>
<PRE>
public void <B>setHighlight</B>(int&nbsp;highlightType)</PRE>
<DL>
<DD>设置查找或替换文本匹配时是否高亮显示匹配区域。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>highlightType</CODE> - 查找或替换文本匹配时匹配区域的显示方式,只能取以下三种值: <pre>      FindConstants.NO_HIGHTLIGHT  0  匹配区域采用非高亮显示      FindConstants.HIGHTLIGHT     1  匹配区域采用高亮显示      FindConstants.NULL_HIGHLIGHT 2  匹配区域不考虑是否高亮显示 </pre> <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); FindReplace  finding = new FindReplace(); finding.clearFormat(); finding.setText("永中OFFICE"); finding.setForward(true); finding.setFormat(true); finding.setHighlight(1); baseText.find(finding);  </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html#getHighlight()"><CODE>getHighlight()</CODE></A>, 

⌨️ 快捷键说明

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