workaround是复制时候重新设置下剪切板
- InputMap inputMap = fpSpread1.GetInputMap(InputMapMode.WhenFocused);
- object key = inputMap.Get(new Keystroke(Keys.C, Keys.Control));
- fpSpread1.GetActionMap().Put(key, new CustomClipboardCopyAction());
复制代码
- public class CustomClipboardCopyAction : FarPoint.Win.Spread.Action
- {
- public override void PerformAction(object sender)
- {
-
- var sheet = sender as SpreadView;
- sheet.GetSheetView().ClipboardCopy();
- var text = System.Windows.Forms.Clipboard.GetText();
- if (!string.IsNullOrWhiteSpace(text))
- {
- if (text.IndexOf("""") >= 0)
- {
- text = text.Replace("""", """);
- if (text.EndsWith("\r\n"))
- {
- text = text.Substring(1, text.Length - 4);
- }
- else if (text.EndsWith("""))
- {
- text = text.Substring(1, text.Length - 1);
- }
- System.Windows.Forms.Clipboard.SetText(text);
- }
- }
- }
- }
复制代码 |