pagenumbers.html

来自「永中OFFICE二次开发帮助文档」· HTML 代码 · 共 1,004 行 · 第 1/4 页

HTML
1,004
字号
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setIncludeChapterNumber(boolean)">setIncludeChapterNumber</A></B>(boolean&nbsp;includeChapter)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置插入页码是否包含章节号(默认页码不包含章节号)。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setPageNumberFormat(int)">setPageNumberFormat</A></B>(int&nbsp;formatType)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置插入页码的数字样式。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setStartingNumber(int)">setStartingNumber</A></B>(int&nbsp;pageStartNumber)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置起始页码。</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>从类 java.lang.Object 继承的方法</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ 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="addPageNumber(int, int)"><!-- --></A><H3>
addPageNumber</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumber.html" title="application.workbooks.workbook.documents.document.section 中的类">PageNumber</A> <B>addPageNumber</B>(int&nbsp;position,
                                int&nbsp;alignment)</PRE>
<DL>
<DD>在当前章节的某一位置添加一个页码。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>position</CODE> - 指定页码添加的垂直位置,只能取以下值之一: <pre>      PageNumbersConstants.POSITION_HEADER                页码位于页眉位置      PageNumbersConstants.POSITION_FOOTER                页码位于页脚位置      PageNumbersConstants.POSITION_CENTER_OF_PAGE        页面纵向中心      PageNumbersConstants.POSITION_INSIDE                页面纵向内侧      PageNumbersConstants.POSITION_OUTSIDE               页面纵向外侧 </pre><DD><CODE>alignment</CODE> - 指定添加页码的水平对齐方式,只能取以下值之一: <pre>      PageNumbersConstants.ALIGNMENT_LEFT      PageNumbersConstants.ALIGNMENT_CENTER      PageNumbersConstants.ALIGNMENT_RIGHT      PageNumbersConstants.ALIGNMENT_INSIDE      PageNumbersConstants.ALIGNMENT_OUTSIDE </pre><DD><CODE>fisrtPage</CODE> - 节中首页是否显示页码。true表示显示页码
<DT><B>返回:</B><DD>返回添加的页码对象 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); PageNumbers pageNumbers = section.getPageNumbers(); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="addPageNumber(int, int, boolean)"><!-- --></A><H3>
addPageNumber</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumber.html" title="application.workbooks.workbook.documents.document.section 中的类">PageNumber</A> <B>addPageNumber</B>(int&nbsp;position,
                                int&nbsp;alignment,
                                boolean&nbsp;fisrtPage)</PRE>
<DL>
<DD>在当前章节的某一位置添加一个页码。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>position</CODE> - 指定页码添加的垂直位置,只能取以下值之一: <pre>      PageNumbersConstants.POSITION_HEADER                页码位于页眉位置      PageNumbersConstants.POSITION_FOOTER                页码位于页脚位置      PageNumbersConstants.POSITION_CENTER_OF_PAGE        页面纵向中心      PageNumbersConstants.POSITION_INSIDE                页面纵向内侧      PageNumbersConstants.POSITION_OUTSIDE               页面纵向外侧 </pre><DD><CODE>alignment</CODE> - 指定添加页码的水平对齐方式,只能取以下值之一: <pre>      PageNumbersConstants.ALIGNMENT_LEFT      PageNumbersConstants.ALIGNMENT_CENTER      PageNumbersConstants.ALIGNMENT_RIGHT      PageNumbersConstants.ALIGNMENT_INSIDE      PageNumbersConstants.ALIGNMENT_OUTSIDE </pre><DD><CODE>fisrtPage</CODE> - 节中首页是否显示页码。true表示显示页码
<DT><B>返回:</B><DD>返回添加的页码对象 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); PageNumbers pageNumbers = section.getPageNumbers(); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER, true); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getChapterPageSeparator()"><!-- --></A><H3>
getChapterPageSeparator</H3>
<PRE>
public int <B>getChapterPageSeparator</B>()</PRE>
<DL>
<DD>获得章节号与页码之间的分隔符类型(分隔符默认为连字号)。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.documents.document.PageNumberAttribute</CODE> 中的 <CODE>getChapterPageSeparator</CODE></DL>
</DD>
<DD><DL>

<DT><B>返回:</B><DD>分隔符类型,只能取以下值之一: <pre>      PageNumbersConstants.SEPARATOE_HYPHEN    页码与章节号之间的分隔符为连字号      PageNumbersConstants.SEPARATOE_PERIOD    页码与章节号之间的分隔符为句号      PageNumbersConstants.SEPARATOE_COLON     页码与章节号之间的分隔符为冒号      PageNumbersConstants.SEPARATOE_EM_DASH   页码与章节号之间的分隔符为长破折号      PageNumbersConstants.SEPARATOE_EN_DASH   页码与章节号之间的分隔符为短破折号 </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! this is a test!"); PageNumbers pageNumbers = section.getPageNumbers(); pageNumbers.setIncludeChapterNumber(true); pageNumbers.setHeadingLeverForCharpter(1); pageNumbers.setChapterPageSeparator(PageNumbersConstants.SEPARATOE_COLON); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER, true); int separator = pageNumbers.getChapterPageSeparator(); System.out.println("章节号与页码之间的分隔符类型为:" + separator); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setChapterPageSeparator(int)"><CODE>setChapterPageSeparator(int)</CODE></A>, 
<CODE>#setHeadingLeverForChapter(int)</CODE>, 
<A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setIncludeChapterNumber(boolean)"><CODE>setIncludeChapterNumber(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getCount()"><!-- --></A><H3>
getCount</H3>
<PRE>
public int <B>getCount</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); PageNumbers pageNumbers = section.getPageNumbers(); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER, true); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_FOOTER, PageNumbersConstants.ALIGNMENT_LEFT, true); int count = pageNumbers.getCount(); System.out.println("返回当前章节页码的个数:"+ count); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getHeadingLeverForChapter()"><!-- --></A><H3>
getHeadingLeverForChapter</H3>
<PRE>
public int <B>getHeadingLeverForChapter</B>()</PRE>
<DL>
<DD>得到包含章节号的起始样式(章节号起始样式默认为标题1)。 注:章节号的起始样式应与带有标题编号段落的样式相同才能正确显示页码章节号。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.documents.document.PageNumberAttribute</CODE> 中的 <CODE>getHeadingLeverForChapter</CODE></DL>
</DD>
<DD><DL>

<DT><B>返回:</B><DD>包含章节号的起始样式,只能取0-8这9个整形值,分别表示标题1-标题9 <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!"); PageNumbers pageNumbers = section.getPageNumbers(); pageNumber.setIncludeChapterNumber(true); pageNumbers.setHeadingLeverForCharpter(1); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER, true); int headingLevel = pageNumber.getHeadingLeverForChapter(); System.out.println("包含章节号的起始样式为:" + headingLevel); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setHeadingLeverForCharpter(int)"><CODE>setHeadingLeverForCharpter(int)</CODE></A>, 
<A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumbers.html#setIncludeChapterNumber(boolean)"><CODE>setIncludeChapterNumber(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getPageNumber(int)"><!-- --></A><H3>
getPageNumber</H3>
<PRE>
public <A HREF="../../../../../../application/workbooks/workbook/documents/document/section/PageNumber.html" title="application.workbooks.workbook.documents.document.section 中的类">PageNumber</A> <B>getPageNumber</B>(int&nbsp;index)</PRE>
<DL>
<DD>得到索引指定的页码。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>index</CODE> - 指定的索引,根据页码添加的顺序排列
<DT><B>返回:</B><DD>返回指定的页码对象 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); PageNumbers pageNumbers = section.getPageNumbers(); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_HEADER, PageNumbersConstants.ALIGNMENT_CENTER, true); pageNumbers.addPageNumber(PageNumbersConstants.POSITION_FOOTER, PageNumbersConstants.ALIGNMENT_LEFT, true); PageNumber pageNumber = pageNumbers.getPageNumber(1); System.out.println("第一个页码的对齐方式为:"+ pageNumber.getAlignment()); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getPageNumberFormat()"><!-- --></A><H3>
getPageNumberFormat</H3>

⌨️ 快捷键说明

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