📄 wppagesetup.html
字号:
<A NAME="getSpaceFromText()"><!-- --></A><H3>
getSpaceFromText</H3>
<PRE>
public double <B>getSpaceFromText</B>()</PRE>
<DL>
<DD>得到距正文距离(以磅值为默认单位)。
<P>
<DD><DL>
<DT><B>返回:</B><DD>距正文距离 说明:get方法默认返回为磅值,如果要用其他的度量单位(英寸、厘米、毫米、十二点活字),可以用 application.util.Utilities.pointToOther(double, int)方法将返回的磅值转换为其他度量单位。 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setDisplayLine(true,1,0,1,PrintConstants.LINE_NUMBER_RESTART_EACH_SECTION); section.setPageSetup(pageSetup); System.out.println("SpaceFromText is "+pageSetup.getSpaceFromText()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getTextDirect()"><!-- --></A><H3>
getTextDirect</H3>
<PRE>
public int <B>getTextDirect</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); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setTextDirect(0); section.setPageSetup(pageSetup); System.out.println("TextDirect is "+pageSetup.getTextDirect()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getVerticalAlignment()"><!-- --></A><H3>
getVerticalAlignment</H3>
<PRE>
public int <B>getVerticalAlignment</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); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setVerticalAlignment(0); section.setPageSetup(pageSetup); System.out.println("FooterPosition is "+pageSetup.getVerticalAlignment()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isFirstPageDifferent()"><!-- --></A><H3>
isFirstPageDifferent</H3>
<PRE>
public boolean <B>isFirstPageDifferent</B>()</PRE>
<DL>
<DD>判断本章节的页眉页脚是否可以首页不同。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.print.PageSetup</CODE> 中的 <CODE>isFirstPageDifferent</CODE></DL>
</DD>
<DD><DL>
<DT><B>返回:</B><DD>布尔型值,如果页眉页脚首页与其他页不同,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setFirstPageDifferent(true); section.setPageSetup(pageSetup); System.out.println("FirstPageDifferent is "+pageSetup.isFirstPageDifferent()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isOddAndEven()"><!-- --></A><H3>
isOddAndEven</H3>
<PRE>
public boolean <B>isOddAndEven</B>()</PRE>
<DL>
<DD>判断本章节的页眉页脚是否奇偶页可以不同。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.print.PageSetup</CODE> 中的 <CODE>isOddAndEven</CODE></DL>
</DD>
<DD><DL>
<DT><B>返回:</B><DD>布尔型值,如果页眉页脚奇偶页不同,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setOddAndEven(true); section.setPageSetup(pageSetup); System.out.println("OddAndEven is "+pageSetup.isOddAndEven()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isShowLineNumber()"><!-- --></A><H3>
isShowLineNumber</H3>
<PRE>
public boolean <B>isShowLineNumber</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); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setDisplayLine(true,1,0,1,PrintConstants.LINE_NUMBER_RESTART_EACH_SECTION); section.setPageSetup(pageSetup); System.out.println("ShowLineNumber is "+pageSetup.isShowLineNumber()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isSuppressEndnotes()"><!-- --></A><H3>
isSuppressEndnotes</H3>
<PRE>
public boolean <B>isSuppressEndnotes</B>()</PRE>
<DL>
<DD>是否在下一个没有隐藏尾注的节的末尾打印尾注。
<P>
<DD><DL>
<DT><B>返回:</B><DD>boolean 是否取消尾注 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); Section section = doc.getSection(0); doc.insertBreak(15, BreakConstants.BREAK_SECTION_NEXTPAGE); BaseText baseText = section.getBaseText(); baseText.insertText(0, "this is a test!\n this is a test!\n this is a test!"); EndNoteOptions endNoteOptions = baseText.getEndNoteOptions(); endNoteOptions.setPosition(0); endNoteOptions.setNumberStyle(2); endNoteOptions.setStartingNumber(1); endNoteOptions.setNumberRule(0); endNoteOptions.setApplyType(0); baseText.addEndNote(10, 2); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setSuppressEndnotes(true); section.setPageSetup(pageSetup); System.out.println("SuppressEndnotes is " + section.getPageSetup().isSuppressEndnotes()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="setColumnCount(int)"><!-- --></A><H3>
setColumnCount</H3>
<PRE>
public void <B>setColumnCount</B>(int count)</PRE>
<DL>
<DD>指定文本栏数量。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>count</CODE> - 文本栏数量,取值范围为1~4。 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setColumnCount(1); section.setPageSetup(pageSetup); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 指定的文本栏数量超出范围</DL>
</DD>
</DL>
<HR>
<A NAME="setDisplayLine(boolean, int, double, int, int)"><!-- --></A><H3>
setDisplayLine</H3>
<PRE>
public void <B>setDisplayLine</B>(boolean printLineNumber,
int firstLineNumber,
double spaceFromText,
int lineNumberSpacing,
int lineNumberStyle)</PRE>
<DL>
<DD>设置页面的行号。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>printLineNumber</CODE> - 取值为“false”时不添加行号,取值为“true”时添加行号<DD><CODE>firstLineNumber</CODE> - 起始编号,有效值为“1-32767”<DD><CODE>spaceFromText</CODE> - 行号与正文之间的距离,取值为“0”时表示自动取值,有效值为“0-623”。<DD><CODE>lineNumberSpacing</CODE> - 行号间距,有效值为“1-100”<DD><CODE>lineNumberStyle</CODE> - 编号样式,取值如下: <pre> PrintConstants.LINE_NUMBER_START_EACH_PAGE 每页重新编号 PrintConstants.LINE_NUMBER_RESTART_EACH_SECTION 每节重新编号 PrintConstants.LINE_NUMBER_CONTINUOUS 连续编号 </pre> <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setDisplayLine(true,1,0,1,PrintConstants.LINE_NUMBER_RESTART_EACH_SECTION); section.setPageSetup(pageSetup); </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> - 当指定常量不存在</DL>
</DD>
</DL>
<HR>
<A NAME="setFirstPageDifferent(boolean)"><!-- --></A><H3>
setFirstPageDifferent</H3>
<PRE>
public void <B>setFirstPageDifferent</B>(boolean isDifferent)</PRE>
<DL>
<DD>设置本章节的页眉页脚是否可以首页不同。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.print.PageSetup</CODE> 中的 <CODE>setFirstPageDifferent</CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>isDifferent</CODE> - 布尔型值,如为true,设置页眉页脚首页与其他页不同;否则,设置页眉页脚首页与其他页相同 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); pageSetup.setFirstPageDifferent(true); section.setPageSetup(pageSetup); </pre></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> fontAttr)</PRE>
<DL>
<DD>设置字体属性。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>fontAttr</CODE> - 字体属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); Section section = doc.getSection(0); WpPageSetup pageSetup = section.getPageSetup(); FontAttribute fontAttr = new FontAttribute(); fontAttr.setFontSize(24); fontAttr.setBold(true); fontAttr.setForeground(java.awt.Color.RED); pageSetup.setFontAttribute(fontAttr); section.setPageSetup(pageSetup); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当字体属性为null</DL>
</DD>
</DL>
<HR>
<A NAME="setFooterPosition(double)"><!-- --></A><H3>
setFooterPosition</H3>
<PRE>
public void <B>setFooterPosition</B>(double footerPosition)</PRE>
<DL>
<DD>设置本章节页脚下端与页面底部之间的距离(以磅值为默认单位)。
<P>
<DD><DL>
<DT><B>覆盖:</B><DD>类 <CODE>application.workbooks.workbook.print.PageSetup</CODE> 中的 <CODE>setFooterPosition</CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>footerPosition</CODE> - 页脚下端与页面底部之
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -