将execl转换成二进制流再转换成字符串,然后再从字符串转换回execl 将execl转换成二进制流再转换成字符串,然后再从字符串转换回execl 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.IO.StreamReader mysr = new System.IO.StreamReader(strpath); //保证中文不乱码 System.IO.StreamReader mysr = new System.IO.StreamReader(strpath, System.Text.Encoding.GetEncoding("gb2312"));strpath是你的文件路径,把mysr 放到dataset或datatable里试一下吧,我用好使 FileStream fs = File.Open( "1.xls" , FileMode.Open , FileAccess.Read , FileShare.ReadWrite); byte[] barray = new byte[fs.Length]; int size =(int)fs.Length; fs.Read( barray , 0 , size ); string str = System.Convert.ToBase64String( barray ); fs.Close(); byte[] btoexcel = System.Convert.FromBase64String( str ); FileStream fs2 = File.Create( "2.xls"); fs2.Write( btoexcel, 0, btoexcel.Length ); fs2.Close(); Bitmap.save()方法怎么使用 listview点击一行就变字体 Runtime的问题 C# MDI子窗体间传值 关于学习C#最基本的问题 TXT复制粘贴的■问题??帮忙解决!! 项目“C:\Project1.csproj”所需的应用程序未安装。 c#中response的使用 求业务流程管理 [求救]C#的继承问题。 高手请进~~~~~~ 高分求教C#获取文件夹路径问题
//保证中文不乱码
System.IO.StreamReader mysr = new System.IO.StreamReader(strpath, System.Text.Encoding.GetEncoding("gb2312"));strpath是你的文件路径,把mysr 放到dataset或datatable里
试一下吧,我用好使
byte[] barray = new byte[fs.Length];
int size =(int)fs.Length;
fs.Read( barray , 0 , size );
string str = System.Convert.ToBase64String( barray );
fs.Close();
byte[] btoexcel = System.Convert.FromBase64String( str );
FileStream fs2 = File.Create( "2.xls");
fs2.Write( btoexcel, 0, btoexcel.Length );
fs2.Close();