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

📄 wpsortproperties.html

📁 永中OFFICE二次开发帮助文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:
 Document document = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = document.getRange(0,0); range.insertTextAfter("name sex age salary"); range.insertTextAfter("\n张三 man 21 2500"); range.insertTextAfter("\n李芸 woman 19 1300"); range.insertTextAfter("\n小燕 woman 25 5300"); range.insertTextAfter("\n刘强 man 45 13000"); range = document.getRange(0,document.getLength()-1); WpSortProperties isort = new WpSortProperties(); isort.setExcludeTitle(true); isort.setSortKey1(4); isort.setSortKey2(2); isort.setSortKey3(1); isort.setSortKey3(SortOrderConstants.PHONETIC); range.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortKeyType1(int)"><!-- --></A><H3>
setSortKeyType1</H3>
<PRE>
public void <B>setSortKeyType1</B>(int&nbsp;sortType)</PRE>
<DL>
<DD>设置主关键字排序的方式。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>sortType</CODE> - 主关键字排序的方式,只能取以下常量之一: <pre> SortOrderConstants.STROKE = 0    以笔划排序 SortOrderConstants.NUMERIC = 1   以数字排序 SortOrderConstants.DATE = 2      以日期排序 SortOrderConstants.PHONETIC = 3  以拼音排序 </pre> <b>例子:</b> <pre> Document document = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = document.getRange(0,0); range.insertTextAfter("name sex age salary"); range.insertTextAfter("\n张三 man 21 2500"); range.insertTextAfter("\n李芸 woman 19 1300"); range.insertTextAfter("\n小燕 woman 25 5300"); range.insertTextAfter("\n刘强 man 45 13000"); range = document.getRange(0,document.getLength()-1); WpSortProperties isort = new WpSortProperties(); isort.setExcludeTitle(true); isort.setSortOrientation(SortOrderConstants.SORT_BY_COLUMN); isort.setSortKey1(2); isort.setSortKeyType1(SortOrderConstants.NUMERIC); range.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortKeyType2(int)"><!-- --></A><H3>
setSortKeyType2</H3>
<PRE>
public void <B>setSortKeyType2</B>(int&nbsp;sortType)</PRE>
<DL>
<DD>设置次关键字排序的方式。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>sortType</CODE> - 次关键字排序的方式,只能取以下常量之一: <pre> SortOrderConstants.STROKE = 0    以笔划排序 SortOrderConstants.NUMERIC = 1   以数字排序 SortOrderConstants.DATE = 2      以日期排序 SortOrderConstants.PHONETIC = 3  以拼音排序 </pre> <b>例子:</b> <pre> Document document = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = document.getRange(0,0); range.insertTextAfter("name sex age salary"); range.insertTextAfter("\n张三 man 21 2500"); range.insertTextAfter("\n李芸 woman 19 1300"); range.insertTextAfter("\n小燕 woman 25 5300"); range.insertTextAfter("\n刘强 man 45 13000"); range = document.getRange(0,document.getLength()-1); WpSortProperties isort = new WpSortProperties(); isort.setExcludeTitle(true); isort.setSortOrientation(SortOrderConstants.SORT_BY_COLUMN); isort.setSortKey1(1); isort.setSortKey1(SortOrderConstants.PHONETIC); isort.setSortKey2(3); isort.setSortKeyType2(SortOrderConstants.NUMERIC); range.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortKeyType3(int)"><!-- --></A><H3>
setSortKeyType3</H3>
<PRE>
public void <B>setSortKeyType3</B>(int&nbsp;sortType)</PRE>
<DL>
<DD>设置第三关键字排序的方式。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>sortType</CODE> - 第三关键字排序的方式,只能取以下常量之一: <pre> SortOrderConstants.STROKE = 0    以笔划排序 SortOrderConstants.NUMERIC = 1   以数字排序 SortOrderConstants.DATE = 2      以日期排序 SortOrderConstants.PHONETIC = 3  以拼音排序 </pre> <b>例子:</b> <pre> Document document = Application.getWorkbooks().getActiveWorkbook().getDocuments().getActiveDocument(); TextRange range = document.getRange(0,0); range.insertTextAfter("name sex age salary"); range.insertTextAfter("\n张三 man 21 2500"); range.insertTextAfter("\n李芸 woman 19 1300"); range.insertTextAfter("\n小燕 woman 25 5300"); range.insertTextAfter("\n刘强 man 45 13000"); range = document.getRange(0,document.getLength()-1); WpSortProperties isort = new WpSortProperties(); isort.setExcludeTitle(true); isort.setSortOrientation(SortOrderConstants.SORT_BY_COLUMN); isort.setSortKey1(1); isort.setSortKey1(SortOrderConstants.PHONETIC); isort.setSortKey2(3); isort.setSortKeyType2(SortOrderConstants.NUMERIC); isort.setSortKey3(2); isort.setSortKeyType3(SortOrderConstants.NUMERIC); range.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortOrientation(int)"><!-- --></A><H3>
setSortOrientation</H3>
<PRE>
public void <B>setSortOrientation</B>(int&nbsp;orientation)</PRE>
<DL>
<DD>当排序对象是表格时,设置排序的方向。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>orientation</CODE> - 排序的方向,只能取以下两种方式之一: <pre> SortOrderConstants.SORT_BY_COLUMN = 1; 按列排序 SortOrderConstants.SORT_BY_ROW = 0;    按行排序 </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); 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));      } } WpSortProperties isort = new WpSortProperties(); isort.setSortKey1(2); isort.setSortKeyType1(SortOrderConstants.NUMERIC); isort.setAscending1(false); isort.setSortOrientation(SortOrderConstants.SORT_BY_COLUMN); table.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortRowOnly(boolean)"><!-- --></A><H3>
setSortRowOnly</H3>
<PRE>
public void <B>setSortRowOnly</B>(boolean&nbsp;bool)</PRE>
<DL>
<DD>当按行进行排序时,设置是否仅对行排序。 说明:此方法仅在表格排序并且按行排序时可用。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>bool</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); 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));      } } WpSortProperties isort = new WpSortProperties(); isort.setSortKey1(2); isort.setSortKeyType1(SortOrderConstants.NUMERIC); isort.setAscending1(false); isort.setSortOrientation(SortOrderConstants.SORT_BY_ROW); isort.setSortRowOnly(true); table.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortSubKey1(int)"><!-- --></A><H3>
setSortSubKey1</H3>
<PRE>
public void <B>setSortSubKey1</B>(int&nbsp;subkey1)</PRE>
<DL>
<DD>设置排序主关键子域。 说明:此方法只有在对表格排序时才有效。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>subkey1</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); 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);      } } WpSortProperties isort = new WpSortProperties(); isort.setSortKey1(2); isort.setSortSubKey1(0); isort.setAscending1(false); table.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortSubKey2(int)"><!-- --></A><H3>
setSortSubKey2</H3>
<PRE>
public void <B>setSortSubKey2</B>(int&nbsp;subkey2)</PRE>
<DL>
<DD>设置排序次关键字子域。 说明:此方法只有在对表格排序时才有效。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>subkey2</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); 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);      } } WpSortProperties isort = new WpSortProperties(); isort.setSortKey1(2); isort.setAscending1(false); isort.setSortKey2(1); isort.setAscending(true); table.sort(isort); </pre></DL>
</DD>
</DL>
<HR>

<A NAME="setSortSubKey3(int)"><!-- --></A><H3>
setSortSubKey3</H3>
<PRE>
public void <B>setSortSubKey3</B>(int&nbsp;subkey3)</PRE>
<DL>
<DD>设置排序第三关键字子域。 说明:此方法只有在对表格排序时才有效。
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>key1</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); 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);      } } WpSortProperties isort = new WpSortProperties(); isort.setSortKey1(2); isort.setSortSubKey1(0); isort.setAscending1(false); isort.setSortKey2(0); isort.setSortSubKey2(0); isort.setAscending2(true); isort.setSortKey3(1); isort.setSortSubKey4(0); isort.setAscending4(false); table.sort(isort); </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>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>类</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../application/workbooks/workbook/documents/document/WpShapes.html" title="application.workbooks.workbook.documents.document 中的类"><B>上一个类</B></A>&nbsp;
&nbsp;下一个类</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?application/workbooks/workbook/documents/document/WpSortProperties.html" target="_top"><B>框架</B></A>  &nbsp;
&nbsp;<A HREF="WpSortProperties.html" target="_top"><B>无框架</B></A>  &nbsp;
&nbsp;<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">
  摘要:&nbsp;嵌套&nbsp;|&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_summary">构造方法</A>&nbsp;|&nbsp;<A HREF="#method_summary">方法</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
详细信息:&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_detail">构造方法</A>&nbsp;|&nbsp;<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 + -