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

📄 basetext.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<DL>
<DD>返回正文部分的长度。
<P>
<DD><DL>
<DT><B>指定者:</B><DD>类 <CODE><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getLength()">getLength</A></CODE></DL>
</DD>
<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! this is a test"); System.out.println("当前正文的长度是:"+baseText.getLength()); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getStartOffset()"><!-- --></A><H3>
getStartOffset</H3>
<PRE>
public int <B>getStartOffset</B>()</PRE>
<DL>
<DD>返回正文在整个文档中的起始位置。
<P>
<DD><DL>

<DT><B>返回:</B><DD>起始位置 <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); BaseText baseText = section.getBaseText(); System.out.println("start offset is " + baseText.getStartOffset()); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getTableOfContent(long, long)"><!-- --></A><H3>
getTableOfContent</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/TableOfContent.html" title="application.workbooks.workbook.documents.document 中的类">TableOfContent</A> <B>getTableOfContent</B>(long&nbsp;offset,
                                        long&nbsp;length)</PRE>
<DL>
<DD>得到一个区域的第一个目录管理器(一个区域可能包含多个目录)。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 区域的指定位置<DD><CODE>length</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 test!\n this is a test!\n this is a test!");  Styles styles = doc.getStyles();  Style style1 = styles.getStyle("标题 1");  Style style2 = styles.getStyle("标题 2");  baseText.formatStyle(0, 15, style1);  baseText.formatStyle(20, 5, style2);  TableOfContent toc = baseText.getTableOfContent(0,10);  baseText.insertTableOfContent(0,toc); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当offset小于0或大于文档长度。
<DD><CODE><A HREF="../../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当offset + length 大于文档长度。
<DD><CODE><A HREF="../../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当指定区域中存在保护区域<DT><B>另请参见:</B><DD><A HREF="../../../../../../application/workbooks/workbook/documents/document/TableOfContent.html" title="application.workbooks.workbook.documents.document 中的类"><CODE>TableOfContent</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getText(long, long)"><!-- --></A><H3>
getText</H3>
<PRE>
public java.lang.String <B>getText</B>(long&nbsp;offset,
                                long&nbsp;length)</PRE>
<DL>
<DD>返回当前章节指定范围的文本。
<P>
<DD><DL>
<DT><B>指定者:</B><DD>类 <CODE><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/AbstractText.html" title="application.workbooks.workbook.documents.document.section 中的类">AbstractText</A></CODE> 中的 <CODE><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/AbstractText.html#getText(long, long)">getText</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>offset</CODE> - 指定范围的起始位置<DD><CODE>length</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 test!\n this is a test!\n this is a test!"); System.out.println("指定的文本为:"+baseText.getText(2,6)); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当offset小于0或大于文档长度
<DD><CODE><A HREF="../../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当offset + length 大于文档长度</DL>
</DD>
</DL>
<HR>

<A NAME="gotoPosition(int, int, int, java.lang.String)"><!-- --></A><H3>
gotoPosition</H3>
<PRE>
public void <B>gotoPosition</B>(int&nbsp;type,
                         int&nbsp;direction,
                         int&nbsp;step,
                         java.lang.String&nbsp;name)</PRE>
<DL>
<DD>定位。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>type</CODE> - 需要定位的类型 <pre> FindConstants.PAGE       表示 定位到页(参数name无效,设为"") FindConstants.SECTION    表示 定位到节(参数name无效,设为"") FindConstants.LINE       表示 定位到行(参数name无效,设为"") FindConstants.BOOKMARK   表示 定位到书签(参数name表示书签名) FindConstants.COMMENT    表示 定位到注释(参数name表示审阅者的姓名) FindConstants.FOOTNOTE   表示 定位到脚注(参数name无效,设为"") FindConstants.ENDNOTE    表示 定位到尾注(参数name无效,设为"") FindConstants.FIELD      表示 定位到域(参数name表示域名,可参考定位对话盒) FindConstants.TABLE      表示 定位到表格(参数name无效,设为"") FindConstants.GRAPHIC    表示 定位到图形(参数name无效,设为"") FindConstants.HEADING    表示 定位到标题(参数name无效,设为"") FindConstants.OBJECT     表示 定位到对象(参数name无效,设为"") FindConstants.CHART      表示 定位到图表(参数name无效,设为"") FindConstants.PASTELINK  表示 定位到粘贴链接(参数name无效,设为"") FindConstants.EQUATION   表示 定位到科教编辑器(参数name无效,设为"") ...... </pre><DD><CODE>direction</CODE> - 需要定位的方向 <pre> FindConstants.PREVIOUS      表示 定位到到前一个位置 FindConstants.NEXT          表示 定位到下一个位置 FindConstants.ABSOLUTE      表示 定位到绝对位置 </pre><DD><CODE>step</CODE> - 需要定位的步长<DD><CODE>name</CODE> - 需要定位的名称 <pre> 如果定位注释  name表示注释的作者 如果定位书签  name表示书签的名字 如果定位域   name表示域的类型 .例如 <Edit Time>表示编辑时间域。name 需要有<> 如果是其它域,那么 name设置无效,可以设置任何值 </pre> <pre>       例如 如果定位到 第10行       gotoPosition(FindConstants.LINE,FindConstants.ABSOLUTE,10,"");       如果在当前位置向前定位3行       gotoPosition(FindConstants.LINE,FindConstants.PREVIOUS,3,"");       如果在当前位置向后定位3行       gotoPosition(FindConstants.LINE,FindConstants.NEXT,3,"");       如果定位到名字为 bookMarkName 的书签上       gotoPosition(FindConstants.BOOKMARK,0,0,"bookMarkName"); <pre> <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!\n this is a test!\n this is a test!"); baseText.gotoPosition(FindConstants.LINE,FindConstants.ABSOLUTE,5,""); </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> - 当需要定位的方向常量不存在
<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/constants/FindConstants.html" title="application.constants 中的接口"><CODE>FindConstants</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="insertChart()"><!-- --></A><H3>
insertChart</H3>
<PRE>
public void <B>insertChart</B>()</PRE>
<DL>
<DD>插入图表。 <p> <b>例

⌨️ 快捷键说明

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