winform程序如何导出word文档 服务器上有一个word文档 c:\temp.doc , 如何把这个服务器上的word文档下载到本机呢?在线等。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 保存远程文件 /// </summary> /// <param name="filePath">远程文件路径</param> /// <returns></returns> public string SaveFile(string filePath) { string fPath, fName, sPath; fPath = filePath.Replace("\\", "/"); int start = fPath.LastIndexOf("/") + 1; fName = fPath.Substring(start, fPath.Length - start); if (newName) { sPath = savePath + getFileName() + "." + getExtension(fName); } else { sPath = savePath + fName; } System.Net.WebClient myWebClient = new System.Net.WebClient(); try { myWebClient.DownloadFile(fPath, sPath); } catch (Exception ee) { throw ee; } finally { myWebClient.Dispose(); } return fName; } 基本思路:服务器端读取word,转换为byte[],客户端接收byte[],然后在保存为word。主要技术:文件流操作。 论坛发贴机原理是什么呀? 怎么让datagridview新行类型变combobox 请教个问题,麻烦高手来看看,刷新的问题,闪的厉害 改变setup里面路径问题 c# .net 发布网站错误码,webconfig,,急急,, C#怎么用DDE? .net2005装完用了一天,第二天回来打不开设计器了,有朋友遇到过吗? 穷人无分--问--如何将pictureBox1里面的图片变成黑白 如何获取鼠标右键点击的内容? 如何按键停止一个进程呢 C++到C# C#里如何像C++那样传递一个数组的地址 子类如何继承抽象类的属性
/// 保存远程文件
/// </summary>
/// <param name="filePath">远程文件路径</param>
/// <returns></returns>
public string SaveFile(string filePath)
{
string fPath, fName, sPath;
fPath = filePath.Replace("\\", "/");
int start = fPath.LastIndexOf("/") + 1;
fName = fPath.Substring(start, fPath.Length - start);
if (newName)
{
sPath = savePath + getFileName() + "." + getExtension(fName);
}
else
{
sPath = savePath + fName;
}
System.Net.WebClient myWebClient = new System.Net.WebClient();
try
{
myWebClient.DownloadFile(fPath, sPath);
}
catch (Exception ee)
{
throw ee;
}
finally
{
myWebClient.Dispose();
}
return fName;
}