SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel表格(*.xlsx)|*.xlsx"; sfd.FilterIndex = 1; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { MessageBox.Show(sfd.FileName.ToString()); } else { MessageBox.Show("取消保存"); return; }