C#保存doc文件

发布时间 2023-06-28 15:56:16作者: 浑浑噩噩一只小迷七

1、使用office组件(Microsoft.Office.Interop.Word)

https://www.cnblogs.com/Joyce-mi7/p/17445396.html

2、使用免费的 Spire.Doc

https://www.cnblogs.com/HoFei/p/17425140.html

3、使用DocX插件

https://blog.csdn.net/zhanfu2905/article/details/68948002

https://www.cnblogs.com/echo-web/p/9511119.html

4、打印文件

public  static void Print(string fileName)
{
   try
   {
       PrintDocument fpd = new PrintDocument();

       string filePath = fileName;
       string printer = fpd.PrinterSettings.PrinterName; //获取默认的打印机
       ProcessStartInfo info = new ProcessStartInfo();
       info.Arguments = "\"" + printer + "\"";
       info.Verb = "PrintTo";
       info.FileName = filePath;
       info.CreateNoWindow = true;
       info.WindowStyle = ProcessWindowStyle.Hidden;

       Process p = new Process();
       p.StartInfo = info;
       p.Start();
       p.WaitForInputIdle();
   }
   catch (Exception ex)
   {
       Console.Error.WriteLine(ex.Message);
   }
}

https://blog.csdn.net/BYH371256/article/details/130898529