内容导出成word

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);
        };

    }
}
原文地址:https://www.cnblogs.com/12jh23/p/7667170.html