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

📄 replacement.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>构造方法详细信息</B></FONT></TH>
</TR>
</TABLE>

<A NAME="Replacement()"><!-- --></A><H3>
Replacement</H3>
<PRE>
public <B>Replacement</B>()</PRE>
<DL>
<DD>默认构造器。
<P>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>方法详细信息</B></FONT></TH>
</TR>
</TABLE>

<A NAME="clearFormat()"><!-- --></A><H3>
clearFormat</H3>
<PRE>
public void <B>clearFormat</B>()</PRE>
<DL>
<DD>清除替换字符的格式,即初始化替换字符格式。 <p> <b>例子:</b> <pre> //请输入一些文字 Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); System.out.println("清除格式前,text = " + replacement.getText()); replacement.clearFormat();  System.out.println("清除格式后,text = " + replacement.getText()); </pre>
<P>
<DD><DL>
<DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setText(java.lang.String)"><CODE>setText(String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getFontAttribute()"><!-- --></A><H3>
getFontAttribute</H3>
<PRE>
public <A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类">FontAttribute</A> <B>getFontAttribute</B>()</PRE>
<DL>
<DD>获取替换文本的字体格式。
<P>
<DD><DL>

<DT><B>返回:</B><DD>FontAttribute类,即替换文本的字体格式 <p> <b>例子:</b> <pre> FindReplace  finding = new FindReplace(); finding.clearFormat(); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); FontAttribute font = new FontAttribute(); font.setBold(true); font.setFontSize(14); replacement.setFont(font); finding.setReplacement(replacement); FontAttribute replaceFont = replacement.getFont(); System.out.println("替换文本是否为粗体:" + replaceFont.isBold()); System.out.println("替换文本的字体大小为:" + replaceFont.getFontSize()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setFont(application.workbooks.workbook.style.font.FontAttribute)"><CODE>setFont(FontAttribute)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/style/font/FontAttribute.html" title="application.workbooks.workbook.style.font 中的类"><CODE>FontAttribute</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>FindReplace</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getFormat()"><!-- --></A><H3>
getFormat</H3>
<PRE>
public boolean <B>getFormat</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.setFormat(true); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); FontAttribute font = new FontAttribute(); font.setFontSize(14); replacement.setFont(font); replacement.setFormat(true); finding.setReplacement(replacement); baseText.replace(finding); boolean isFormat = replacement.getFormat(); System.out.println("替换的文本是否设置了格式:" + isFormat); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setFormat(boolean)"><CODE>setFormat(boolean)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#clearFormat()"><CODE>clearFormat()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>FindReplace</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getHighlight()"><!-- --></A><H3>
getHighlight</H3>
<PRE>
public int <B>getHighlight</B>()</PRE>
<DL>
<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); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("Microsoft"); replacement.setHighlight(1); finding.setReplacement(replacement); baseText.replace(finding);  int isHighlight = replacement.getHighlight(); System.out.println("替换文本匹配时是否高亮显示匹配区域:" + isHighlight); </pre>
<P>
<DD><DL>
<DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setHighlight(int)"><CODE>setHighlight(int)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#clearFormat()"><CODE>clearFormat()</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>FindReplace</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>ParagraphAttribute类,即替换文本的段落格式 <p> <b>例子:</b> <pre> FindReplace  finding = new FindReplace(); finding.clearFormat(); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); ParagraphAttribute paraAttribute = new ParagraphAttribute(); paraAttribute.setAlignment(ParagraphConstants.ALIGNMENT_LEFT);  paraAttribute.setLeftIndent(5.0f);  replacement.setParagraph(paraAttribute); finding.setReplacement(replacement); ParagraphAttribute replacepara = replacement.getParagraph(); System.out.println("替换文本的段落对齐方式为:" + replacepara.getAlignment()); System.out.println("替换文本的段落左缩进为:" + replacepara.getLeftIndent()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setParagraphAttribute(application.workbooks.workbook.style.paragraph.ParagraphAttribute)"><CODE>setParagraphAttribute(ParagraphAttribute)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/style/paragraph/ParagraphAttribute.html" title="application.workbooks.workbook.style.paragraph 中的类"><CODE>ParagraphAttribute</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>FindReplace</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> FindReplace  finding = new FindReplace(); finding.clearFormat(); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); replacement.setStyle("标题 2"); finding.setReplacement(replacement); String style = replacement.getStyle(); System.out.println("替换文本的样式为:" + style); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/documents/document/Replacement.html#setStyle(java.lang.String)"><CODE>setStyle(String)</CODE></A>, 
<A HREF="../../../../../application/workbooks/workbook/documents/document/FindReplace.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>FindReplace</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getText()"><!-- --></A><H3>
getText</H3>
<PRE>
public java.lang.String <B>getText</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.setText("永中OFFICE"); finding.clearFormat(); Replacement replacement = new Replacement(); replacement.clearFormat(); replacement.setText("microsoft"); finding.setReplacement(replacement); baseText.replace(finding); String text = replacement.getText(); System.out.println("需要替换的字符串为:" + text);

⌨️ 快捷键说明

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