try
{
stringtemplateRes ="命名空间.导入模板.xls";
Assemblyassembly =Assembly.GetExecutingAssembly();
varstream = assembly.GetManifestResourceStream(templateRes);
varbytes =newbyte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
SaveFileDialogs =newSaveFileDialog();
s.FileName ="导入模板.xls";
s.Filter ="Excel|*.xls";
if(s.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileStreamfs =newFileStream(s.FileName,FileMode.OpenOrCreate,FileAccess.ReadWrite);
fs.Write(bytes, 0, bytes.Length);
fs.Flush();
fs.Close();
GridHelper.OpenFile(s.FileName);
}
}
catch(Exceptionex)
{
MessageHelper.Error(ex);
}
网友评论