⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置当前表格的表格属性集。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setTableHeader(int, java.lang.String[])">setTableHeader</A></B>(int&nbsp;styleType,
               java.lang.String[]&nbsp;titles)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;插入斜线表头。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setTableStyle(int)">setTableStyle</A></B>(int&nbsp;style)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置当前表格的样式。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setTableStyle(int, boolean, boolean, boolean, boolean)">setTableStyle</A></B>(int&nbsp;style,
              boolean&nbsp;applyStyleHeadingRow,
              boolean&nbsp;applyStyleLastRow,
              boolean&nbsp;applyStyleFirstColumn,
              boolean&nbsp;applyStyleLastColumn)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置当前表格的样式。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#sort(boolean)">sort</A></B>(boolean&nbsp;order)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>已过时。</B>&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#sort(application.workbooks.workbook.documents.document.WpSortProperties)">sort</A></B>(<A HREF="../../../../application/workbooks/workbook/documents/document/WpSortProperties.html" title="application.workbooks.workbook.documents.document 中的类">WpSortProperties</A>&nbsp;sortProperties)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对表格按指定的排序选项进行排序。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../application/workbooks/workbook/tables/Table.html#splitTable(int)">splitTable</A></B>(int&nbsp;row)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在表格中紧靠指定行的上面插入一空段落,并且返回一个 Table 对象,此对象包含指定行及其下一行。</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>从类 java.lang.Object 继承的方法</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>方法详细信息</B></FONT></TH>
</TR>
</TABLE>

<A NAME="autoFit(int)"><!-- --></A><H3>
autoFit</H3>
<PRE>
public void <B>autoFit</B>(int&nbsp;autofitType)</PRE>
<DL>
<DD>设置表格如何自动调整表格的大小。可以根据表格单元格的内容或文档窗口的宽度重新调整表格的大小, 也可使用本方法来关闭“自动调整”功能,这样,表格的大小是固定值,而不随单元格内容或窗口宽度而改变。 说明:如果 TableAttribute中的AllowAutoFit 属性值当前为 False,则将“自动调整”操作设为  AUTOFIT_CONTENT 或 AUTOFIT_WINDOW 后,其值会变为 True。同样,如果 AllowAutoFit 属性值当前为 True, 则将“自动调整”操作设为 FIXED_COLUMN_WIDTH后,该属性值会变为 False。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>autofitType</CODE> - 表格自动调整大小的方式,可以有以下三种方式: <pre> TableConstants.AUTOFIT_CONTENT = 0     根据内容调整表格 TableConstants.AUTOFIT_WINDOW = 1      根据窗口调整表格 TableConstants.FIXED_COLUMN_WIDTH = 2  固定列宽 </pre> <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, TableConstants.FIXED_COLUMN_WIDTH, 40.0f); application.workbooks.workbook.tables.Cell cell = table.getCell(2,3); cell.getRange().insertText("单元格对象"); table.autoFit(TableConstants.AUTOFIT_CONTENT); </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/tables/TableAttribute.html#setAllowAutoFit(boolean)"><CODE>TableAttribute.setAllowAutoFit(boolean)</CODE></A>, 
<A HREF="../../../../application/workbooks/workbook/tables/TableAttribute.html#isAllowAutoFit()"><CODE>TableAttribute.isAllowAutoFit()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="convertToText(char, boolean)"><!-- --></A><H3>
convertToText</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/documents/document/TextRange.html" title="application.workbooks.workbook.documents.document 中的类">TextRange</A> <B>convertToText</B>(char&nbsp;seperator,
                               boolean&nbsp;isNesting)</PRE>
<DL>
<DD>将表格转换为文本并返回一个 TextRange 对象。 说明:表格转换为文本,原来的表格被删除,转换后的新文本在原表格起始位置插入。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>seperator</CODE> - 分隔符,作为单元格转换为文本时的分隔符,是一个字符值,默认有三种 <pre>   段落标记   '\n'     制表符    '\t'  (默认) 逗号      ',' 也可以为其他字符,如 '*'.... </pre><DD><CODE>isNesting</CODE> - 是否要将嵌套表格转换为文本
<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(); for (int i = 0; i < rows.getCount(); i++) {      Row row = rows.getRow(i);      Cells cells = row.getCells();      for (int j = 0; j < cells.getCount(); j++)      {          cells.getCell(j).getRange().insertText("行" + i + "列" + j);      } } TextRange range = table.convertToText('\n', false); range.select(); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="delete()"><!-- --></A><H3>
delete</H3>
<PRE>
public void <B>delete</B>()</PRE>
<DL>
<DD>删除指定的表格。  <p> <b>例子:</b> <pre> Document doc = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = doc.getRange(0); Tables tables = doc.getTables(); Table table1 = tables.addTable(range, 5, 5, "我的表格"); range.insertText("无锡永中科技有限公司\n无锡永中科技有限公司\n无锡永中科技有限公司\n"); range = doc.getRange(doc.getLength()); Table table2 = tables.addTable(range, 3, 4); table1.delete(); </pre>
<P>
<DD><DL>
<DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/Tables.html#removeTable(int)"><CODE>Tables.removeTable(int)</CODE></A>, 
<A HREF="../../../../application/workbooks/workbook/Tables.html#removeTable(java.lang.String)"><CODE>Tables.removeTable(String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getBorderAttribute()"><!-- --></A><H3>
getBorderAttribute</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/style/border/BorderAttribute.html" title="application.workbooks.workbook.style.border 中的类">BorderAttribute</A> <B>getBorderAttribute</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); BorderAttribute borderAttribute = table.getBorderAttribute(); System.out.println("返回表格外边框的类型为:"+ borderAttribute.getBorderType()); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#setBorderAttribute(application.workbooks.workbook.style.border.BorderAttribute)"><CODE>setBorderAttribute(BorderAttribute)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getCell(int, int)"><!-- --></A><H3>
getCell</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Cell.html" title="application.workbooks.workbook.tables 中的类">Cell</A> <B>getCell</B>(int&nbsp;row,
                    int&nbsp;column)</PRE>
<DL>
<DD>得到指定行号列号的单个单元格对象。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>row</CODE> - 指定的行号(注意:表格中的行列号是从1开始计算的)<DD><CODE>column</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.Cell cell = table.getCell(2,3); cell.getRange().insertText("单元格对象"); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="getColumns()"><!-- --></A><H3>
getColumns</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Columns.html" title="application.workbooks.workbook.tables 中的类">Columns</A> <B>getColumns</B>()</PRE>
<DL>
<DD>返回一个 Columns 集合,该集合代表表格中的所有列。
<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.Columns columns = table.getColumns(); System.out.println("表格共有" + columns.getCount() + "列"); </pre><DT><B>另请参见:</B><DD><A HREF="../../../../application/workbooks/workbook/tables/Table.html#getColumns(int, int)"><CODE>getColumns(int, int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getColumns(int, int)"><!-- --></A><H3>
getColumns</H3>
<PRE>
public <A HREF="../../../../application/workbooks/workbook/tables/Columns.html" title="application.workbooks.workbook.tables 中的类">Columns</A> <B>getColumns</B>(int&nbsp;startColumn,
                          int&nbsp;endColumn)</PRE>
<DL>
<DD>返回一个 Columns 集合,该集合代表指定集合的多个表格列。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>startColumn</CODE> - 指定集合的起始列号(注意:表格中的行列号是从1开始计算的)<DD><CODE>endColumn</CODE> - 指定集合的结束列号(注意:表格中的行列号是从1开始计算的)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -