📄 pageborderattribute.html
字号:
pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); pageBorderAttr.setAlignWithPage(true); doc.setPageBorderAttribute(pageBorderAttr); System.out.println(doc.getPageBorderAttribute().isAlignWithPage()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isShowInFront()"><!-- --></A><H3>
isShowInFront</H3>
<PRE>
public boolean <B>isShowInFront</B>()</PRE>
<DL>
<DD>判断页面边框是否总在最上方显示。
<P>
<DD><DL>
<DT><B>返回:</B><DD>flag 布尔型值,如果页面边框总在前面显示,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); pageBorderAttr.setShowInFront(true); doc.setPageBorderAttribute(pageBorderAttr); System.out.println(doc.getPageBorderAttribute().isShowInFront()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isSurroundFooter()"><!-- --></A><H3>
isSurroundFooter</H3>
<PRE>
public boolean <B>isSurroundFooter</B>()</PRE>
<DL>
<DD>判断是否将页脚包含在页面边框之内。 <br> 注:必须设置当前的度量依据为正文,边框属性才能设置环绕页眉页脚。 环绕页脚就是使边框的下边距为边框与页脚底边之间的距离。
<P>
<DD><DL>
<DT><B>返回:</B><DD>布尔型值,如果将页脚包含在页面边框之内,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); pageBorderAttr.setSurroundFooter(true); doc.setPageBorderAttribute(pageBorderAttr); System.out.println(doc.getPageBorderAttribute().isSurroundFooter()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="isSurroundHeader()"><!-- --></A><H3>
isSurroundHeader</H3>
<PRE>
public boolean <B>isSurroundHeader</B>()</PRE>
<DL>
<DD>判断是否将页眉包含在页面边框之内。 <br> (注:必须设置当前的度量依据为正文,边框属性才能设置环绕页眉页脚。 环绕页眉就是使边框的上边距为边框与页眉顶边之间的距离。)
<P>
<DD><DL>
<DT><B>返回:</B><DD>布尔型值,如果页眉包含在页面边框之内,返回true;否则,返回false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); pageBorderAttr.setSurroundHeader(true); doc.setPageBorderAttribute(pageBorderAttr); System.out.println(doc.getPageBorderAttribute().isSurroundHeader()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="setAlignWithPage(boolean)"><!-- --></A><H3>
setAlignWithPage</H3>
<PRE>
public void <B>setAlignWithPage</B>(boolean flag)</PRE>
<DL>
<DD>将段落边框与表格边界与页面边框对齐。(即设置“段落边框与表格边界与页面边框对齐”) <br> 注:必须设置当前的度量依据为正文,才能设置段落边框与表格边界与页面边框对齐。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>flag</CODE> - 布尔型值,如为true,表示将段落边框与表格边界与页面边框对齐;否则,段落边框与表格边界不对齐页面边框 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); pageBorderAttr.setAlignWithPage(true); doc.setPageBorderAttribute(pageBorderAttr); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="setBorderLineColor(int, java.awt.Color)"><!-- --></A><H3>
setBorderLineColor</H3>
<PRE>
public void <B>setBorderLineColor</B>(int borderPosition,
java.awt.Color color)</PRE>
<DL>
<DD>设置边框线颜色。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>borderPosition</CODE> - 边缘边框类型,其常量和相应的值如下: <pre> BorderAndShadingConstants.LEFT = 0 左边缘边框 BorderAndShadingConstants.TOP = 1 上边缘边框 BorderAndShadingConstants.RIGHT = 2 右边缘边框 BorderAndShadingConstants.BOTTOM = 3 下边缘边框 </pre><DD><CODE>color</CODE> - 边框线颜色,如Color.red <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); doc.setPageBorderAttribute(pageBorderAttr); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/border/PageBorderAttribute.html#getBorderLineColor(int)"><CODE>getBorderLineColor(int borderPosition)</CODE></A>,
<A HREF="../../../../../application/constants/BorderAndShadingConstants.html" title="application.constants 中的接口"><CODE>BorderAndShadingConstants</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setBorderLineType(int, int)"><!-- --></A><H3>
setBorderLineType</H3>
<PRE>
public void <B>setBorderLineType</B>(int borderPosition,
int lineType)</PRE>
<DL>
<DD>设置边框线条属性。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>borderPosition</CODE> - 边缘边框类型,其常量和相应的值如下: <pre> BorderAndShadingConstants.LEFT = 0 左边缘边框 BorderAndShadingConstants.TOP = 1 上边缘边框 BorderAndShadingConstants.RIGHT = 2 右边缘边框 BorderAndShadingConstants.BOTTOM = 3 下边缘边框 </pre><DD><CODE>lineType</CODE> - 线条类型 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); PageBorderAttribute pageBorderAttr = doc.getPageBorderAttribute(); pageBorderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_SHADOW); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.TOP, 1); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.LEFT, 3); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT, 6); pageBorderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM, 8); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.TOP, Color.RED); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT, Color.CYAN); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT, Color.YELLOW); pageBorderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM, Color.ORANGE); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP, 8f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT, 5f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT, 3f); pageBorderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM, 1f); doc.setPageBorderAttribute(pageBorderAttr); </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="setBorderLineWidth(int, float)"><!-- --></A><H3>
setBorderLineWidth</H3>
<PRE>
public void <B>setBorderLineWidth</B>(int borderPosition,
float width)</PRE>
<DL>
<DD>设置边框线宽度(以磅值为默认单位)。
<P>
<DD><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -