找回密码
 立即注册

QQ登录

只需一步,快速开始

lh8350

论坛元老

33

主题

80

帖子

2万

积分

论坛元老

积分
23275

活字格认证

lh8350
论坛元老   /  发表于:2012-8-6 10:08  /   查看:4527  /  回复:3
1,默认的复制粘贴,ctrl+c,和ctrl+v是粘贴单元格中的所有内容,包括公式,背景色等,能不能设置只复制粘贴数值呢?
2,设置了这个属性以后Spread01.ClipboardPasteToFill=true;能批量的粘贴复制了,但是怎么能只复制粘贴可见列,而不包括隐藏列呢?
3, im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Delete, Keys.None), FarPoint.Win.Spread.SpreadActions.ClearSelectedCells);利用此方法删除选中单元格,能不能至删除其中的值呢,不删除颜色设置等等

3 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-8-6 12:29:00
沙发
回答1、一方面可以通过Spread的KeyDown事件中实现自己的复制粘贴行为;另外也可以通过改变默认的 InputMap 来实现:
  1.     FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();

  2.     im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
  3.     im.Put(new FarPoint.Win.Spread.Keystroke(Keys.C, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardCopyValues);

  4.     im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
  5.     im.Put(new FarPoint.Win.Spread.Keystroke(Keys.C, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardCopyValues);
复制代码


回答2:
  1.     FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();

  2.     im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
  3.     im.Put(new FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteAsStringSkipHidden);

  4.     im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
  5.     im.Put(new FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteAsStringSkipHidden);
复制代码


回答3:
如果现有Action不能完全满足你的需求,你可以继承FarPoint.Win.Spread.Action类型实现自己的需求
回复 使用道具 举报
lh8350
论坛元老   /  发表于:2012-8-6 13:17:00
板凳
spread.Sheets[0].ClipboardCopy(FarPoint.Win.Spread.ClipboardCopyOptions.Values);
spread.Sheets[0].ClipboardCopy(FarPoint.Win.Spread.ClipboardCopyOptions.AsStringSkipHidden);我是在keydown事件中写的,不知道这样是否可行?
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-8-6 18:09:00
地板
通过KeyDown和InputMap都可以,如果通过InputMap能够满足你的需求,还是建议使用InputMap方法。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部