📄 documents.html
字号:
<DL>
<DD>此方法用于清除对比文档中不同之处的高亮显示,对于普通设置的高亮显示无效。 <p> <b>例子: </b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); docs.addDocument("文档1"); docs.addDocument("文档2"); Document doc1 = docs.getDocument("文档1"); Document doc2 = docs.getDocument("文档2"); doc1.getSection(0).getBaseText().insertText(0,"this is a test!!"); doc2.getSection(0).getBaseText().insertText(0,"this is a text"); docs.compareDocument(doc1,doc2,Color.YELLOW); docs.clearDifference(); </pre>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="closeDocument(java.lang.String)"><!-- --></A><H3>
closeDocument</H3>
<PRE>
public void <B>closeDocument</B>(java.lang.String name)</PRE>
<DL>
<DD>关闭指定的文字处理文档。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>name</CODE> - 文字处理文档名。 <p> <b>例子:</b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); docs.closeDocument("文档1"); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="compareDocument(application.workbooks.workbook.documents.Document, application.workbooks.workbook.documents.Document, java.awt.Color)"><!-- --></A><H3>
compareDocument</H3>
<PRE>
public void <B>compareDocument</B>(<A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> doc1,
<A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> doc2,
java.awt.Color color)</PRE>
<DL>
<DD>对比两个文档,以指定的高亮颜色标示出内容不同的位置。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>doc1</CODE> - 要比较的文档,如果为null,则不做比较<DD><CODE>doc2</CODE> - 要比较的文档,如果为null,则不做比较<DD><CODE>color</CODE> - 在不同处显示的高亮颜色,如果为null,则不做高亮显示。 <p> <b>例子:</b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); docs.addDocument("文档1"); docs.addDocument("文档2"); Document doc1 = docs.getDocument("文档1"); Document doc2 = docs.getDocument("文档2"); doc1.getSection(0).getBaseText().insertText(0,"this is a test!!"); doc2.getSection(0).getBaseText().insertText(0,"this is a text"); docs.compareDocument(doc1,doc2,Color.YELLOW); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getActiveDocument()"><!-- --></A><H3>
getActiveDocument</H3>
<PRE>
public <A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> <B>getActiveDocument</B>()</PRE>
<DL>
<DD>获取当前活动文字处理文档对象。
<P>
<DD><DL>
<DT><B>返回:</B><DD>Document 当前活动文字处理文档对象,如当前活动窗口对象不是文字处理文档,则返回Null <p> <b>例子: </b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); System.out.println("当前文档的名字是:"+doc.getName()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类"><CODE>Document</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getAllDocuments()"><!-- --></A><H3>
getAllDocuments</H3>
<PRE>
public <A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A>[] <B>getAllDocuments</B>()</PRE>
<DL>
<DD>返回当前集成文件中所有的文字处理文档。如果如果当前没有文字处理文档 ,则返回的数组长度为0。
<P>
<DD><DL>
<DT><B>返回:</B><DD>Document[] 返回当前集成文件中所有的文字处理文档组成的一个数组 <p> <b>例子: </b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); docs.addDocument(); Document[] documents = docs.getAllDocuments(); System.out.println("当前集成文件所有文档的个数为:" + documents.length); </pre><DT><B>另请参见:</B><DD><A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类"><CODE>Document</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getDocument(java.lang.String)"><!-- --></A><H3>
getDocument</H3>
<PRE>
public <A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> <B>getDocument</B>(java.lang.String name)</PRE>
<DL>
<DD>返回一个文字处理文档。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>name</CODE> - 需要返回的文字处理文档的名字
<DT><B>返回:</B><DD>Document 如果对应的文字处理文档不存在,返回null <p> <b>例子: </b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getDocument("文档1"); if (doc != null) { BaseText baseText = doc.getSection(0).getBaseText(); baseText.insertText(0,"this is a test!\nthis is a test!\nthis is a test!"); System.out.println("当前文档的内容是:"+baseText.getText(0,baseText.getTextLength())); } </pre><DT><B>另请参见:</B><DD><A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类"><CODE>Document</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#removeDocument(java.lang.String)"><CODE>removeDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#rename(java.lang.String, java.lang.String)"><CODE>rename(String,String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#addDocument(java.lang.String)"><CODE>addDocument(String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="openDocument(java.lang.String)"><!-- --></A><H3>
openDocument</H3>
<PRE>
public <A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> <B>openDocument</B>(java.lang.String name)</PRE>
<DL>
<DD>打开一个已经被关闭的文字处理文档。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>name</CODE> - 需要打开一个文字处理文档的名字
<DT><B>返回:</B><DD>指定名称的文字处理文档,如果文字处理文档不存在,返回null。 <p> <b>例子: </b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); docs.addDocument(); docs.closeDocument("文档1"); Document doc = docs.openDocument("文档1"); if (doc != null) { System.out.println("当前打开的文档名是:" + doc.getName()); } else { System.out.println("文档1打开失败!"); } </pre><DT><B>另请参见:</B><DD><A HREF="../../../application/workbooks/workbook/Documents.html#getDocument(java.lang.String)"><CODE>getDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#removeDocument(java.lang.String)"><CODE>removeDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#rename(java.lang.String, java.lang.String)"><CODE>rename(String,String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="removeDocument(java.lang.String)"><!-- --></A><H3>
removeDocument</H3>
<PRE>
public void <B>removeDocument</B>(java.lang.String name)</PRE>
<DL>
<DD>删除一个文字处理文档。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>name</CODE> - 需要删除的文字处理文档的名字 <p> <b>例子: </b> <pre> Application.getWorkbooks().getActiveWorkbook().getDocuments().removeDocument("文档1"); </pre><DT><B>另请参见:</B><DD><A HREF="../../../application/workbooks/workbook/Documents.html#getDocument(java.lang.String)"><CODE>getDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#rename(java.lang.String, java.lang.String)"><CODE>rename(String,String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#addDocument(java.lang.String)"><CODE>addDocument(String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="rename(java.lang.String, java.lang.String)"><!-- --></A><H3>
rename</H3>
<PRE>
public <A HREF="../../../application/workbooks/workbook/documents/Document.html" title="application.workbooks.workbook.documents 中的类">Document</A> <B>rename</B>(java.lang.String oldName,
java.lang.String newName)</PRE>
<DL>
<DD>重命名一个文字处理文档。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>oldName</CODE> - 需要重命名的文字处理文档的旧名字<DD><CODE>newName</CODE> - 更名后的文字处理文档的新名字
<DT><B>返回:</B><DD>重命后的文字处理文档,如果需要重命名的文字处理文档不存在,则返回null。 <p> <b>例子: </b> <pre> Documents docs = Application.getWorkbooks().getActiveWorkbook().getDocuments(); Document newDoc = docs.rename("文档1", "文档11"); newDoc = docs.open("文档11"); if (newDoc != null) { System.out.println("重命名后的文档的名字是:" + newDoc.getName()); } else { System.out.println("文档11 不存在或没有打开!"); } </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.html#getDocument(java.lang.String)"><CODE>getDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#removeDocument(java.lang.String)"><CODE>removeDocument(String)</CODE></A>,
<A HREF="../../../application/workbooks/workbook/Documents.html#addDocument(java.lang.String)"><CODE>addDocument(String)</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="跳过导航链接"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>类</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../application/workbooks/workbook/CustomFileProperties.html" title="application.workbooks.workbook 中的类"><B>上一个类</B></A>
<A HREF="../../../application/workbooks/workbook/FileProperties.html" title="application.workbooks.workbook 中的类"><B>下一个类</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?application/workbooks/workbook/Documents.html" target="_top"><B>框架</B></A>
<A HREF="Documents.html" target="_top"><B>无框架</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
摘要: 嵌套 | 字段 | 构造方法 | <A HREF="#method_summary">方法</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
详细信息: 字段 | 构造方法 | <A HREF="#method_detail">方法</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
版权所有 2001-2006 无锡永中科技有限公司
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -