您好,确认是产品BUG,对/t处理有问题。 现有的解决方案是在ClipboardChanged事件中处理
- private void FpSpread2_ClipboardChanged(object sender, EventArgs e)
- {
- IDataObject data = Clipboard.GetDataObject();
- string clipText = string.Empty;
- if (data.GetDataPresent(DataFormats.StringFormat))
- clipText = (string)data.GetData(DataFormats.StringFormat);
- else if (data.GetDataPresent(DataFormats.UnicodeText))
- clipText = (string)data.GetData(DataFormats.UnicodeText);
- else if (data.GetDataPresent(DataFormats.OemText))
- clipText = (string)data.GetData(DataFormats.OemText);
- else if (data.GetDataPresent(DataFormats.Text))
- clipText = (string)data.GetData(DataFormats.Text);
- if (clipText != string.Empty)
- {
- string[] rows = clipText.Split(new string[] { "\r\n" }, StringSplitOptions.None);
- int columnHeaderRowCount = fpSpread1.ActiveSheet.ColumnHeader.RowCount;
- int rowHeaderColCount = fpSpread1.ActiveSheet.RowHeader.ColumnCount;
- for (int i = 0; i < columnHeaderRowCount; i++)
- {
- rows[i] = rows[i] = rows[i].Substring(rowHeaderColCount, rows[i].Length - rowHeaderColCount);
- }
- clipText = string.Join("\r\n", rows);
- IDataObject correctedData = new DataObject();
- correctedData.SetData(clipText);
- Clipboard.SetDataObject(correctedData);
- }
- }
复制代码
(211650) |