ListView 复制到剪切板
private void 导出ToolStripMenuItem_Click(object sender, EventArgs e) { Clipboard.SetText(GetListView(listViewData)); } public string GetListView(ListView listview) { string outStr = ""; string single; for (int i = 0; i < listview.Items.Count; i++) { single = ""; if (i == 0) { for (var j = 1; j < listview.Columns.Count; j++) { single = single + listview.Columns[j].Text + "\t"; } single = single.Substring(0, single.Length - 1) + "\r\n"; } for (var j = 1; j < listview.Columns.Count; j++) { single = single + listview.Items[i].SubItems[j].Text.Replace("\n", "") + "\t"; } outStr = outStr + single.Substring(0, single.Length - 1) + "\r\n"; } return outStr; }