⼆进制数据转换为word⽂件
/// <summary>
/// ⼆进制数据转换为word⽂件
/// </summary>
/// <param name="data">⼆进制数据</param>
/// <param name="fileName">word⽂件名</param>
/// <returns>word保存的相对路径</returns>
public string ByteConvertWord(byte[] data, string fileName)
{
string savePath = @"SystemWord"+FormatNowTime(2)+@"";
if (!System.IO.Directory.Exists(GetPath() + savePath))
{
Directory.CreateDirectory(GetPath() + savePath);
}
savePath += fileName + ".doc";
string filePath = GetPath() + savePath;
FileStream fs;
getsavefilenameif (System.IO.File.Exists(filePath))
{
fs = new FileStream(filePath, FileMode.Truncate);
}
else
{
fs = new FileStream(filePath, FileMode.CreateNew);
}
BinaryWriter br = new BinaryWriter(fs);
br.Write(data, 0, data.Length);
br.Close();
fs.Close();
return savePath;
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。