首页 > 其他 > 详细

内容导出成word

时间:2017-10-14 16:01:43      阅读:210      评论:0      收藏:0      [点我收藏+]
private void 导出word(string 内容)
{
    string tit = "<html xmlns:v=\"urn:schemas-microsoft-com:vml\"   xmlns:o=\"urn:schemas-microsoft-com:office:office\"   xmlns:w=\"urn:schemas-microsoft-com:office:word\"   xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\"   xmlns=\"http://www.w3.org/TR/REC-html40\">";

    string path = string.Empty;
    System.Windows.Forms.SaveFileDialog fbd = new System.Windows.Forms.SaveFileDialog();
    fbd.Filter = "所有文件 (*.doc)|*.doc";
    if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        path = fbd.FileName;
        byte[] myByte = System.Text.Encoding.UTF8.GetBytes(tit+内容);
        using (FileStream fsWrite = new FileStream(path, FileMode.Create))
        {
            fsWrite.Write(myByte, 0, myByte.Length);
        };

    }
}

 

内容导出成word

原文:http://www.cnblogs.com/12jh23/p/7667170.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!