word文档存入数据库并取出来 把word文档保存到临时文件,然后把二进制数据写入数据库。建议同时写入文件的作者、大小、名字和摘要和修改时间以便于搜索。读出来的时候把数据导出到临时文件再用Word打开就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 将Byte()转换为文件 /// </summary> /// <param name="name">文件名</param> /// <param name="obj">文件路径</param> /// <param name="fileByte">Byte()数组</param> public void ChangeBtyeToFile(string filePath, byte[] fileByte) { FileStream fs; try { fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); fs.Write(fileByte, 0, fileByte.Length); fs.Close(); } catch (Exception ex) { throw ex; } } /// <summary> /// 将文件序列化为Byte数组 /// </summary> /// <param name="path">文件路径</param> /// <returns>Byte()</returns> public byte[] ChangeFileToByte(string filePath) { FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); byte[] tempByte = null; if (fs.Length > 0) { tempByte = new byte[fs.Length]; fs.Read(tempByte, 0, Convert.ToInt32(fs.Length)); } fs.Close(); return tempByte; }希望对你有帮助 帮我看下这个问题 高手请进 EventLogPermission this.notifyIcon1.Text长度问题 100分急求C#高手帮忙??? 问下问题 代码注释写作者名称,还是写代号? asp.net调用powershell 因为验证控件,aspx在本地执行正常,而在服务器上执行不正常 关于个人简历报表的图像控件 C#网络开发中遇到的问题 希望各位大虾帮助 未将对象引用设置到对象的实例。 跪求C#下如何实现自定义结构或类与BYTE数组之间的相互转换(即数据的打包与解包)?
/// 将Byte()转换为文件
/// </summary>
/// <param name="name">文件名</param>
/// <param name="obj">文件路径</param>
/// <param name="fileByte">Byte()数组</param>
public void ChangeBtyeToFile(string filePath, byte[] fileByte)
{
FileStream fs;
try
{
fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
fs.Write(fileByte, 0, fileByte.Length);
fs.Close();
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// 将文件序列化为Byte数组
/// </summary>
/// <param name="path">文件路径</param>
/// <returns>Byte()</returns>
public byte[] ChangeFileToByte(string filePath)
{
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
byte[] tempByte = null;
if (fs.Length > 0)
{
tempByte = new byte[fs.Length];
fs.Read(tempByte, 0, Convert.ToInt32(fs.Length));
}
fs.Close();
return tempByte;
}
希望对你有帮助