private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (txtWorkNo.Text.Length > 0) { string cachePath = System.IO.Directory.GetCurrentDirectory() + @"\cache"; ExcelAdapter.SaveGirdersAsNewFile(cachePath, Entity); } }
private void btSaveAs_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog { Title = "请选择保存目录", Filter = "Excel工作簿(*xls*)|*.xls*", }; if (dialog.ShowDialog() == DialogResult.OK) { string file = dialog.FileName;//返回文件的完整路径 ExcelAdapter.SaveGirdersAsNewFile(file, Entity); } }