📄 cell.html
字号:
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格内的编辑区域 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); TextRange range = cell.getRange(); range.insertText("无锡永中科技有限公司"); FontAttribute font = new FontAttribute(); font.setBold(true); font.setAsianFontFamily("永中楷体"); font.setForeground(java.awt.Color.red); range.setFontAttribute(font); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getRow()"><!-- --></A><H3>
getRow</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Row.html" title="application.workbooks.workbook.tables 中的类">Row</A> <B>getRow</B>()</PRE>
<DL>
<DD>获得当前单元格所在的行对象。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格的行对象 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2, 3); Row row = cell.getRow(); row.select(); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getShadingAttribute()"><!-- --></A><H3>
getShadingAttribute</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/style/border/ShadingAttribute.html" title="application.workbooks.workbook.style.border 中的类">ShadingAttribute</A> <B>getShadingAttribute</B>()</PRE>
<DL>
<DD>得到表格单个单元格的底纹属性。
<P>
<DD><DL>
<DT><B>返回:</B><DD>单元格的底纹属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2, 3); ShadingAttribute shadingAttribute = cell.getShadingAttribute(); System.out.println("返回单元格的底纹图案索引:"+ shadingAttribute.getTextureIndex()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Cell.html#setShadingAttribute(application.workbooks.workbook.style.border.ShadingAttribute)"><CODE>setShadingAttribute(ShadingAttribute)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setBorderAttribute(application.workbooks.workbook.style.border.BorderAttribute)"><!-- --></A><H3>
setBorderAttribute</H3>
<PRE>
public void <B>setBorderAttribute</B>(<A HREF="../../../../application/workbooks/workbook/style/border/BorderAttribute.html" title="application.workbooks.workbook.style.border 中的类">BorderAttribute</A> borderAttribute)</PRE>
<DL>
<DD>设置表格单个单元格的边框属性。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>borderAttribute</CODE> - 单元格的边框属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2, 3); BorderAttribute borderAttribute = cell.getBorderAttribute(); borderAttribute.setBorderType(BorderAndShadingConstants.BORDERTYPE_BOX); borderAttribute.setBorderLineType(BorderAndShadingConstants.TOP,1); borderAttribute.setBorderLineType(BorderAndShadingConstants.LEFT,3); borderAttribute.setBorderLineType(BorderAndShadingConstants.RIGHT,6); borderAttribute.setBorderLineType(BorderAndShadingConstants.BOTTOM,8); borderAttribute.setBorderLineColor(BorderAndShadingConstants.TOP,Color.RED); borderAttribute.setBorderLineColor(BorderAndShadingConstants.LEFT,Color.CYAN); borderAttribute.setBorderLineColor(BorderAndShadingConstants.RIGHT,Color.YELLOW); borderAttribute.setBorderLineColor(BorderAndShadingConstants.BOTTOM,Color.ORANGE); borderAttribute.setBorderLineWidth(BorderAndShadingConstants.TOP,8f); borderAttribute.setBorderLineWidth(BorderAndShadingConstants.LEFT,5f); borderAttribute.setBorderLineWidth(BorderAndShadingConstants.RIGHT,3f); borderAttribute.setBorderLineWidth(BorderAndShadingConstants.BOTTOM,1f); cell.setBorderAttribute(borderAttribute); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当参数为NULL<DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Cell.html#getBorderAttribute()"><CODE>getBorderAttribute()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setCellAttribute(application.workbooks.workbook.tables.CellAttribute)"><!-- --></A><H3>
setCellAttribute</H3>
<PRE>
public void <B>setCellAttribute</B>(<A HREF="../../../../application/workbooks/workbook/tables/CellAttribute.html" title="application.workbooks.workbook.tables 中的类">CellAttribute</A> cellAttribute)</PRE>
<DL>
<DD>设置指定单元格的单元格属性。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>cellAttribute</CODE> - 单元格属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); CellAttribute cellAttribute = cell.getCellAttribute(); cellAttribute.setVerticalAlignment(TableConstants.V_BOTTOM); cellAttribute.setWordWrap(false); cell.setCellAttribute(cellAttribute); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Cell.html#getCellAttribute()"><CODE>getCellAttribute()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setFormula(java.lang.String)"><!-- --></A><H3>
setFormula</H3>
<PRE>
public void <B>setFormula</B>(java.lang.String formula)</PRE>
<DL>
<DD>在指定单元格内插入表格计算的公式。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>formula</CODE> - 计算的公式 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 7, 3); String[] titles = {"姓名", "年龄", "薪水"}; String[] names = {"张明", "李峰", "王双", "陈江", "华韵"}; Integer[] ages = new Integer[]{27, 32, 15, 66, 24}; Integer[] salary = new Integer[]{2300, 4500, 1000, 900, 2000}; application.workbooks.workbook.tables.Columns columns = table.getColumns(); for (int i = 0; i < columns.getCount(); i++) { Object[] values = null; String c = "A"; switch(i) { case 0: c = "A"; values = names; break; case 1: c = "B"; values = ages; break; case 2: c = "C"; values = salary; break; } Column col = columns.getColumn(i); Cells cells = col.getCells(); for (int j = 0; j < cells.getCount(); j++) { if (j == 0) { cells.getCell(j).getRange().insertText(titles[i]); } else if (j == cells.getCount() - 1) { if (i == 0) continue; String formulaRange = c + 2 + ":" + c + (cells.getCount()-1); cells.getCell(j).setFormula("=SUM("+formulaRange+")"); } else { cells.getCell(j).getRange().insertText(values[j-1].toString()); } } } </pre></DL>
</DD>
</DL>
<HR>
<A NAME="setShadingAttribute(application.workbooks.workbook.style.border.ShadingAttribute)"><!-- --></A><H3>
setShadingAttribute</H3>
<PRE>
public void <B>setShadingAttribute</B>(<A HREF="../../../../application/workbooks/workbook/style/border/ShadingAttribute.html" title="application.workbooks.workbook.style.border 中的类">ShadingAttribute</A> shadingAttribute)</PRE>
<DL>
<DD>设置表格单个单元格的底纹属性。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>shadingAttribute</CODE> - 单元格的底纹属性 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2, 3); ShadingAttribute shadingAttribute = cell.getShadingAttribute(); shadingAttribute.setTextureIndex(10); cell.setShadingAttribute(shadingAttribute); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当参数为NULL<DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Cell.html#getShadingAttribute()"><CODE>getShadingAttribute()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="split(int, int)"><!-- --></A><H3>
split</H3>
<PRE>
public void <B>split</B>(int row,
int column)</PRE>
<DL>
<DD>拆分表格单元格。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>row</CODE> - 拆分的行数<DD><CODE>column</CODE> - 拆分的列数 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table = tables.addTable(range, 5, 5); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); cell.split(2,2); </pre></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/tables/CellAttribute.html" title="application.workbooks.workbook.tables 中的类"><B>下一个类</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?application/workbooks/workbook/tables/Cell.html" target="_top"><B>框架</B></A>
<A HREF="Cell.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="#method_summary">方法</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
详细信息: 字段 | 构造方法 | <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 + -