dataGridView
-
C# WinForms DataGridView 복사 후 워드에 저장하기닷넷/WinForms 2023. 3. 21. 17:47
2018.07.20 - [C#/WinForm] - C# DataGridView 엑셀 출력 빠르게 하기 (복사&붙여넣기) C# DataGridView 엑셀 출력 빠르게 하기 (복사&붙여넣기) 이전에 포스팅한 2017/05/24 - [프로그래밍/C#] - C# DataGridView 데이터 엑셀파일에 저장 using oledb 은 데이터그리드뷰의 데이터를 엑셀파일로 출력할 때 속도가 느리다는 단점이 있다. 어떻게 하면 빠르 jasmintime.com 여기서 DataGridView의 데이터를 클립보드에 저장한 걸 응용해서 Word에 붙여넣기하는 방식은 다음과 같습니다. // 데이터그리드뷰 전체 선택 dataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMod..
-
C# DataGridView 편집, 추가, 삭제, 열 다시 정렬닷넷/WinForms 2019. 4. 21. 09:04
// 편집 불가능(읽기) dataGridView1.ReadOnly = true; // 편집 가능(읽기, 쓰기) dataGridView1.ReadOnly = false; // 추가 O dataGridView1.AllowUserToAddRows = true; // 추가 X dataGridView1.AllowUserToAddRows = false; // 삭제 O dataGridView1.AllowUserToDeleteRows = true; // 삭제 X dataGridView1.AllowUserToDeleteRows = false; // 열 다시 정렬 O dataGridView1.AllowUserToOrderColumns = true; // 열 다시 정렬 X dataGridView1.AllowUserToOrd..
-
C# 데이터그리드뷰 CSV 파일로 저장하기닷넷/WinForms 2019. 4. 14. 21:14
private void Save_Csv(string fileName, DataGridView dgv, bool header) { string delimiter = "`"; // 구분자 FileStream fs = new FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write); StreamWriter csvExport = new StreamWriter(fs, System.Text.Encoding.UTF8); if (dgv.Rows.Count == 0) return; // 헤더정보 출력 if (header) { for (int i = 0; i
-
C# DataGridView 데이터 엑셀파일에 저장 using oledb닷넷/C# 2017. 5. 24. 13:43
엑셀 라이브러리 참조없이 OleDb를 이용한 방법으로 DataGridView의 데이터를 엑셀로 출력하는 방법이다.이때, 엑셀파일을 File 을 이용해 생성하면 제대로 생성되지 않아 사용할 없다.따라서 소스를 보면 알겠지만 엑셀파일 하나를 복사해서 거기에 데이터를 저장하는 편법을 이용했다. OleDbConnection conn = null; try { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel File(.xls)|*.xls"; if (sfd.ShowDialog() == DialogResult.OK) { FileInfo fi = new FileInfo(sfd.FileName); if (!fi.Exists) { File.Copy(Applic..