frmMerageExcel.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace wispro.sp.winClient
  11. {
  12. public partial class frmMerageExcel : Form
  13. {
  14. public frmMerageExcel()
  15. {
  16. InitializeComponent();
  17. }
  18. private void label1_Click(object sender, EventArgs e)
  19. {
  20. }
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. FolderBrowserDialog fbd = new FolderBrowserDialog();
  24. if (fbd.ShowDialog() == DialogResult.OK)
  25. {
  26. txtSaveFilePath.Text = System.IO.Path.Combine(fbd.SelectedPath, $"{DateTime.Now.ToString("yyyyMMdd")}-{DateTime.Now.Month - 1}月份绩效计算案件清单.xlsx");
  27. }
  28. }
  29. private void button2_Click(object sender, EventArgs e)
  30. {
  31. OpenFileDialog ofd = new OpenFileDialog()
  32. {
  33. Multiselect = true,
  34. Filter = "Excel文件|*.xls;*.xlsx|全部文件|*.*"
  35. };
  36. if (ofd.ShowDialog() == DialogResult.OK)
  37. {
  38. lstFiles.Items.AddRange(ofd.FileNames);
  39. }
  40. }
  41. public string SaveFilePath { get; set; }
  42. private void button4_Click(object sender, EventArgs e)
  43. {
  44. if (!string.IsNullOrEmpty(txtSaveFilePath.Text) && lstFiles.Items.Count > 0)
  45. {
  46. string[] files = new string[lstFiles.Items.Count];
  47. for (int i = 0; i < lstFiles.Items.Count; i++)
  48. {
  49. files[i] = lstFiles.Items[i].ToString();
  50. }
  51. new wispro.sp.utility.ExcelHelper().MerageExcel(txtSaveFilePath.Text, files);
  52. SaveFilePath = txtSaveFilePath.Text;
  53. }
  54. this.DialogResult = DialogResult.OK;
  55. this.Close();
  56. }
  57. private void button3_Click(object sender, EventArgs e)
  58. {
  59. this.DialogResult = DialogResult.Cancel;
  60. this.Close();
  61. }
  62. }
  63. }