📄 table.html
字号:
<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.Columns columns = table.getColumns(2, 3); System.out.println("表格共有" + columns.getCount() + "列"); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当startColumn大于等于endColumn时,或者当参数越界时<DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#getColumns()"><CODE>getColumns()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public java.lang.String <B>getName</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(); tables.addTable(range, 5, 5, "我的表格"); Table table = tables.getTable(0); System.out.println("表格名字为:" + table.getName()); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getRows()"><!-- --></A><H3>
getRows</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Rows.html" title="application.workbooks.workbook.tables 中的类">Rows</A> <B>getRows</B>()</PRE>
<DL>
<DD>返回一个 Rows 集合,该集合代表表格中所有的表格行。
<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.Rows rows = table.getRows(); System.out.println("表格共有" + rows.getCount() + "行"); </pre></DL>
</DD>
</DL>
<HR>
<A NAME="getRows(int, int)"><!-- --></A><H3>
getRows</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Rows.html" title="application.workbooks.workbook.tables 中的类">Rows</A> <B>getRows</B>(int startRow,
int endRow)</PRE>
<DL>
<DD>返回一个 Rows 集合,该集合代表指定集合的多个表格行。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>startRow</CODE> - 指定集合的起始行号(注意:表格中的行列号是从1开始计算的)<DD><CODE>endRow</CODE> - 指定集合的结束行号(注意:表格中的行列号是从1开始计算的)
<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.Rows rows = table.getRows(2, 4); System.out.println("表格共有" + rows.getCount() + "行"); </pre>
<DT><B>抛出:</B>
<DD><CODE><A HREF="../../../../application/exceptions/MacroRunException.html" title="application.exceptions 中的类">MacroRunException</A></CODE> - 当startRow大于等于endRow时,或者当参数越界时</DL>
</DD>
</DL>
<HR>
<A NAME="getSelectionCells()"><!-- --></A><H3>
getSelectionCells</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Cells.html" title="application.workbooks.workbook.tables 中的类">Cells</A> <B>getSelectionCells</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); Cells cells = table.getSelectionCells(); application.workbooks.workbook.tables.CellAttribute cellAttribute = cells.getCellAttribute(); cellAttribute.setPreferredWidthMeasure(TableConstants.CELL_WIDTH_MEASURE); cellAttribute.setPreferredWidth(40.0f); cells.setCellAttribute(cellAttribute); </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); ShadingAttribute shadingAttribute = table.getShadingAttribute(); System.out.println("返回整个表格的底纹图案索引:"+ shadingAttribute.getTextureIndex()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setShadingAttribute(application.workbooks.workbook.style.border.ShadingAttribute)"><CODE>setShadingAttribute(ShadingAttribute)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getTableAttribute()"><!-- --></A><H3>
getTableAttribute</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/TableAttribute.html" title="application.workbooks.workbook.tables 中的类">TableAttribute</A> <B>getTableAttribute</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); TableAttribute tableAttribute = table.getTableAttribute(); System.out.println("表格的对齐方式为:" + tableAttribute.getAlignment()); System.out.println("表格的列宽是否会根据单元格中的内容自动调整:" + tableAttribute.isAllowAutoFit()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setTableAttribute(application.workbooks.workbook.tables.TableAttribute)"><CODE>setTableAttribute(TableAttribute)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="select()"><!-- --></A><H3>
select</H3>
<PRE>
public void <B>select</B>()</PRE>
<DL>
<DD>选择指定的表格。 <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); tables.addTable(range, 5, 5); Table table = tables.getTable(0); table.select(); </pre>
<P>
<DD><DL>
</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); BorderAttribute borderAttribute = table.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); table.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/Table.html#getBorderAttribute()"><CODE>getBorderAttribute()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setName(java.lang.String)"><!-- --></A><H3>
setName</H3>
<PRE>
public boolean <B>setName</B>(java.lang.String tableName)</PRE>
<DL>
<DD>设置当前表格的名字。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>tableName</CODE> - 指定表格的名字
<DT><B>返回:</B><DD>布尔值,如果为true,则表示修改成功,否则为false <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); tables.addTable(range, 5, 5, "我的表格"); Table table = tables.getTable(0); table.setName("表格新名字"); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#getName()"><CODE>getName()</CODE></A></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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -