FarPoint Spread 基础知识

FarPoint Spread 基础知识1.获得当前行的行号,列号,总列数,总行数introwCount=fpSpread1.ActiveSheet.RowCount;intcolCount=fpSpread1.ActiveSheet.Columns.Count;intactiveRow=fpSpread1.Activ…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

1.获得当前行的行号,列号,总列数,总行数

                int rowCount = fpSpread1.ActiveSheet.RowCount;
                int colCount = fpSpread1.ActiveSheet.Columns.Count;
                int activeRow = fpSpread1.ActiveSheet.ActiveRowIndex;
                int activeCol = fpSpread1.ActiveSheet.ActiveColumnIndex;

2.设置单元格格式时候用 MultiColumnComboBoxCellType 是注意:只能用字符类型字段的选择。要想用数字字段选择的话须将数字类型转换为字符型即可。

ContractedBlock.gif
ExpandedBlockStart.gif
Code

  FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType mCombox = new FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType();
            mCombox.ColumnEditName 
= customerCode;
            mCombox.DataColumnName 
= customerCode;
            mCombox.ListWidth 
= 556;
            mCombox.MaxDrop 
= 8;
            mCombox.DataSourceList 
= dataset;

            fpSpread1.ActiveSheet.Columns[0].Label = customerCode;
            fpSpread1.ActiveSheet.Columns[
0].CellType = mCombox;

3.问题:当下拉mCombox 中的数据少时会出现空白单元格,目前还不知道咋回事!

4.增加和刪除行

      fpSpread1.ActiveSheet.Rows.Add(rowCount, rows);rowCount是添加行的起始位置,rows是添加的行數。

      fpSpread1.ActiveSheet.Rows.Remove(rowCount, rows);rowCount是刪除行的起始位置,rows刪除的行數。

5.

 if (fpSpread1.ActiveSheet.ActiveRow.Index == fpSpread1.ActiveSheet.RowCount – 1) //如果是到最后一行則增加一行
            {

                if (e.KeyCode == Keys.Down)
                {

                    DetailAdd();
                }
            }
            if (e.KeyCode == Keys.Delete)  //按delete鍵可刪除當前活動單元格內容
            {

                fpSpread1.ActiveSheet.ActiveCell.ResetValue();
            }
            if (e.KeyCode == Keys.Enter)  //按Enter鍵跳到下一單元格
            {

                int rowCount = fpSpread1.ActiveSheet.RowCount;
                int colCount = fpSpread1.ActiveSheet.Columns.Count;
                int activeRow = fpSpread1.ActiveSheet.ActiveRowIndex;
                int activeCol = fpSpread1.ActiveSheet.ActiveColumnIndex;
                if (activeCol != (colCount-1))
                {

                    fpSpread1.ActiveSheet.SetActiveCell(activeRow, activeCol + 1);
                }
                else if( activeRow != (rowCount – 1))
                {

                    fpSpread1.ActiveSheet.SetActiveCell(activeRow+1,0);
                }
            }

6.移除选择的多行

               int rowCount = fpSpread1.ActiveSheet.RowCount;
                for (int row = 0; row < rowCount; row++)   //移除選擇行
                {

                    if (fpSpread1.ActiveSheet.IsSelected(row, 1) == true)
                    { fpSpread1.ActiveSheet.Rows.Remove(row, 1); }
                }

7.剪切,复制,粘贴

            //剪切:
            FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction = new        FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction();
        fpSpread1.UndoManager.PerformUndoAction(cutAction);      
            //复制      
detail.ActiveSheet.ClipboardCopy();

            //粘贴
            FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction pasteAction = new FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction(ClipboardPasteOptions.All);
            detail.UndoManager.PerformUndoAction(pasteAction);

 

ContractedBlock.gif
ExpandedBlockStart.gif
Code

SheetView sv = fpSpread1.ActiveSheet;
      
if (sv == null)
        
return;
      
int activeRow = sv.ActiveRowIndex;
      
int activeColumn = sv.ActiveColumnIndex;
      
if (sender == menuCut) //剪切
      {

        FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction 
= new FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction();
        fpSpread1.UndoManager.PerformUndoAction(cutAction);
      }
      
else if (sender == menuCopy) //复制
      {

        sv.ClipboardCopy();
      }
      
else if (sender == menuPaste) //粘贴
      {

        FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction pasteAction 
= new FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction(ClipboardPasteOptions.All);
        fpSpread1.UndoManager.PerformUndoAction(pasteAction);
      }
      
else if (sender == menuInsertRow) //插入一行
      {

        sv.Rows.Add(activeRow, 
1);
      }
      
else if (sender == menuInsertColumn)//插入一列
      {

        sv.Columns.Add(activeColumn, 
1);
      }
      
else if (sender == menuRemoveRow)//删除一行
      {

        sv.Rows.Remove(activeRow, 
1);
      }
      
else if (sender == menuRemoveColumn)//删除一列
      {

        sv.Columns.Remove(activeColumn, 
1);
      }
      
else if (sender == menuClearContents) //清除内容
      {

        FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction 
= new FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction();
        fpSpread1.UndoManager.PerformUndoAction(cutAction);
      }

 8.撤销,恢复

ContractedBlock.gif
ExpandedBlockStart.gif
Code

//撤销
FarPoint.Win.Spread.InputMap im;
im 
= fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(
new FarPoint.Win.Spread.Keystroke(Keys.U, Keys.None), FarPoint.Win.Spread.SpreadActions.Undo);
//恢复
FarPoint.Win.Spread.InputMap im;
im 
= fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(
new FarPoint.Win.Spread.Keystroke(Keys.E, Keys.None), FarPoint.Win.Spread.SpreadActions.Redo);

 9.Find,Filter,Sort

ContractedBlock.gif
ExpandedBlockStart.gif
Code

//允许列排序
this.fpSpread1_Sheet1.Columns.Get(0).AllowAutoSort = true;
//允许列过滤
fpSpread1.ActiveSheet.Columns.Get(1).AllowAutoFilter = true;
//查找
fpSpread1.SearchWithDialogAdvanced(04Thistruetruefalsefalse00);

 

转载于:https://www.cnblogs.com/Tonyyang/archive/2008/09/04/1284102.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/230836.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • vue 分页 Pagination

    vue 分页 Pagination<el-pagination@size-change=”handleSizeChange”@current-change=”handleCurrentChange” :current-page.sync=”paging.currentPage”:page-sizes=”paging.pageSizes” :page-size=”paging.pageSize”layout=”total,prev,pager,next,jumper” :total=”paging.total”.

    2022年10月1日
    0
  • linux的vi命令详解_linux中如何更新vi

    linux的vi命令详解_linux中如何更新vi最近vi用的多,很多技巧不知道,备注一份,vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令。由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您可以在其他任何介绍vi的地方进一步了解它。Vi也是Linux中最基本的文本编辑器,学会它后,您将在Linux的世界里畅行无阻。

    2025年6月12日
    0
  • hibernate二级缓存(一)一级缓存与二级缓存

    hibernate二级缓存(一)一级缓存与二级缓存hibernate二级缓存(一)一级缓存与二级缓存1.hibernate一级缓存hibernate的一级缓存是session级别的缓存,一级缓存hibernate默认启用且不能被卸载,一个事务内有效。特点:使用一级缓存的目的是为了减少对数据库的访问次数,从而提升hibernate的执行效率;(当执行一次查询操作的时候,执行第二次查询操作,先检查缓存中是否有数据,如果有数据就不查询数据库…

    2022年5月24日
    34
  • python发送soap报文_python处理SOAP API

    python发送soap报文_python处理SOAP API我们常见的API一般是restful,但是有的时候也会遇到非restful的时候,对于RestfulAPI,我们很容易用python处理。SOAPAPI我们如何来处理呢?首先我们需要了解RestfulAPI和SOAPAPI架构TheRepresentationalStateTransfer(REST)架构服务通过统一资源定位器(URL)公开。这个逻辑名称将资源的标识与所接…

    2022年7月13日
    20
  • Linux系统(根目录下)目录介绍

    Linux系统(根目录下)目录介绍1./bin目录/bin目录包含了引导启动所需的命令或普通用户可能用的命令(可能在引导启动后)。这些命令都是二进制文件的可执行程序(bin是binary–二进制的简称)

    2022年7月2日
    31
  • Java 集合概览

    Java 集合概览JavaCollectionAPI提供了一些列的类和接口来帮助我们存储和管理对象集合。其实Java中的集合工作起来像是一个数组,不过集合的大小是可以动态改变的,而且集合也提供了更多高级功能。有了JavaCollectionAPI,我们就不需要自己编写集合类了,大部分Java集合类都位于java.util包里面,还有一些和并发相关的集合类位于java.util.concurrent包中。下面就介绍

    2022年7月16日
    13

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号