至少到目前为止,我还没有找到一个可以直接从二进制流读出来直接进行编缉而不进行保存的.在这里也问过,不过没有答案.所以,只好把二进制流读出来保存到硬盘上,再进行打开编辑,当WORD关闭时,把它删掉.
方法和保存到数据库大概是一样的,只不过是由saveFileDialog来完成的,而且FileMode要改变一下.
try
{
fileCommand=new SqlCommand("SELECT FileBody FROM tblFile WHERE FileName='"+comboBox1.Text+"'",fileConnection);
byte[] b=(byte[])fileCommand.ExecuteScalar();
string file=comboBox1.Text;
/* if(b.Length > 0)
{
// Open a stream for the image and write the bytes into it
System.IO.MemoryStream stream = new System.IO.MemoryStream(b, true);
stream.Write(b, 0, b.Length);
// Draw photo to scale of picturebox
DrawToScale(new Bitmap(stream));
// Close the stream and delete the temp file
stream.Close();
}*/
if(b.Length>0)
{
System.IO.MemoryStream stream=new MemoryStream(b,true);
//stream.Write(b,0,b.Length);
saveFileDialog1.FileName=file;
if(DialogResult.OK==saveFileDialog1.ShowDialog())
{