📄 borderattribute.html
字号:
<b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); BorderAttribute borderAttr = doc.getBorderAttribute(); borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,1); borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,3); borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,6); borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,8); borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,Color.RED); borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.CYAN); borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,Color.YELLOW); borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,Color.ORANGE); borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,8f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,5f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,3f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,1f); doc.setBorderAttribute(borderAttr); </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/style/border/BorderAttribute.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 下边缘边框 BorderAndShadingConstants.MIDDLE_HORIZON = 4 中间水平线边框 BorderAndShadingConstants.MIDDLE_VERTICAL = 5 中间垂直线边框 BorderAndShadingConstants.DIAGONAL_FORWARD = 6 左上对角线边框 BorderAndShadingConstants.DIAGONAL_BACKWARD = 7 右上对角线边框<DD><CODE>lineType</CODE> - 线条类型 </pre> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); BorderAttribute borderAttr = doc.getBorderAttribute(); borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,1); borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,3); borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,6); borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,8); borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,Color.RED); borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.CYAN); borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,Color.YELLOW); borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,Color.ORANGE); borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,8f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,5f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,3f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,1f); doc.setBorderAttribute(borderAttr); </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/style/border/BorderAttribute.html#getBorderLineType(int)"><CODE>getBorderLineType(int borderPosition)</CODE></A>,
<A HREF="../../../../../application/constants/BorderAndShadingConstants.html" title="application.constants 中的接口"><CODE>BorderAndShadingConstants</CODE></A></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>
<DT><B>参数:</B><DD><CODE>borderPosition</CODE> - 边缘边框类型,其常量和相应的值如下: <pre> BorderAndShadingConstants.LEFT = 0 左边缘边框 BorderAndShadingConstants.TOP = 1 上边缘边框 BorderAndShadingConstants.RIGHT = 2 右边缘边框 BorderAndShadingConstants.BOTTOM = 3 下边缘边框 BorderAndShadingConstants.MIDDLE_HORIZON = 4 中间水平线边框 BorderAndShadingConstants.MIDDLE_VERTICAL = 5 中间垂直线边框 BorderAndShadingConstants.DIAGONAL_FORWARD = 6 左上对角线边框 BorderAndShadingConstants.DIAGONAL_BACKWARD = 7 右上对角线边框 </pre><DD><CODE>width</CODE> - 边框线条的宽度 说明:set方法的参数默认取磅值,如果要用其他的度量单位(英寸、厘米、毫米、十二点活字), 可以用 application.util.Utilities.otherToPoint(double, int)方法将其他度量单位转换为磅值后再调用相应的设置方法。 <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); BorderAttribute borderAttr = doc.getBorderAttribute(); borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,1); borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,3); borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,6); borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,8); borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,Color.RED); borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.CYAN); borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,Color.YELLOW); borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,Color.ORANGE); borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,8f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,5f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,3f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,1f); doc.setBorderAttribute(borderAttr); </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/style/border/BorderAttribute.html#getBorderLineWidth(int)"><CODE>getBorderLineWidth(int borderPosition)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setBorderType(int)"><!-- --></A><H3>
setBorderType</H3>
<PRE>
public void <B>setBorderType</B>(int borderType)</PRE>
<DL>
<DD>设置边框类型。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>borderType</CODE> - 边框的类型,其常量和相应的值如下: <pre> BorderAndShadingConstants.BORDERTYPE_NONE = 0 表示无边框 BorderAndShadingConstants.BORDERTYPE_BOX = 1 表示方框格式 BorderAndShadingConstants.BORDERTYPE_SHADOW = 2 表示阴影边框格式。注意:此类型在电子表格中无效) BorderAndShadingConstants.BORDERTYPE_ALL = 2 表示全部边框格式。注意:此类型只在电子表格中有效) BorderAndShadingConstants.BORDERTYPE_THREED = 3 表示三维边框格式。注意:此类型在电子表格中无效) BorderAndShadingConstants.BORDERTYPE_GRID = 3 表示网格边框格式。注意:此类型只在电子表格中有效) BorderAndShadingConstants.BORDERTYPE_CUSTOM = 4 表示自定义格式 </pre> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); BorderAttribute borderAttr = doc.getBorderAttribute(); borderAttr.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttr.setBorderLineType(BorderAndShadingConstants.TOP,1); borderAttr.setBorderLineType(BorderAndShadingConstants.LEFT,3); borderAttr.setBorderLineType(BorderAndShadingConstants.RIGHT,6); borderAttr.setBorderLineType(BorderAndShadingConstants.BOTTOM,8); borderAttr.setBorderLineColor(BorderAndShadingConstants.TOP,Color.RED); borderAttr.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.CYAN); borderAttr.setBorderLineColor(BorderAndShadingConstants.RIGHT,Color.YELLOW); borderAttr.setBorderLineColor(BorderAndShadingConstants.BOTTOM,Color.ORANGE); borderAttr.setBorderLineWidth(BorderAndShadingConstants.TOP,8f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.LEFT,5f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.RIGHT,3f); borderAttr.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,1f); doc.setBorderAttribute(borderAttr); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当边框类型不存在<DT><B>另请参见:</B><DD><A HREF="../../../../../application/workbooks/workbook/style/border/BorderAttribute.html#getBorderType()"><CODE>getBorderType()</CODE></A>,
<A HREF="../../../../../application/constants/BorderAndShadingConstants.html" title="application.constants 中的接口"><CODE>BorderAndShadingConstants</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setTemplateBorder(int)"><!-- --></A><H3>
setTemplateBorder</H3>
<PRE>
public void <B>setTemplateBorder</B>(int position)</PRE>
<DL>
<DD>当设定边框类型为"方框"时,此方法将指定某个边框为模板边框,并依据此模板边框来设置其它的边框类型、颜色、宽度。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>position</CODE> - 边缘边框类型,其常量和相应的值如下: <pre> BorderAndShadingConstants.BorderAndShadingConstants.LEFT = 0 左边缘边框 BorderAndShadingConstants.BorderAndShadingConstants.TOP = 1 上边缘边框 BorderAndShadingConstants.BorderAndShadingConstants.RIGHT = 2 右边缘边框 BorderAndShadingConstants.BorderAndShadingConstants.BOTTOM = 3 下边缘边框 </pre> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments() .getActiveDocument(); BorderAttribute borderAttribute = new BorderAttribute(); borderAttribute.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttribute.setBorderLineType(BorderAndShadingConstants.LEFT,2); borderAttribute.setBorderLineWidth(BorderAndShadingConstants.LEFT,0.5f); borderAttribute.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.RED); borderAttribute.setTemplateBorder(BorderAndShadingConstants.LEFT); doc.setBorderAttribute(borderAttribute); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - position参数设置常量不存在时<DT><B>另请参见:</B><DD><A HREF="../../../../../application/constants/BorderAndShadingConstants.html" title="application.constants 中的接口"><CODE>BorderAndShadingConstants</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/style/border/PageBorderAttribute.html" title="application.workbooks.workbook.style.border 中的类"><B>下一个类</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?application/workbooks/workbook/style/border/BorderAttribute.html" target="_top"><B>框架</B></A>
<A HREF="BorderAttribute.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="#constructor_summary">构造方法</A> | <A HREF="#method_summary">方法</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
详细信息: 字段 | <A HREF="#constructor_detail">构造方法</A> | <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 + -