需要引用Microsoft.Office.Interop.Word组件

private void Docx2Doc(object sourceFileName, object targetFileName)
{object missingValue = System.Reflection.Missing.Value;Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref sourceFileName,ref missingValue, ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue, ref missingValue);object FileFormat = msWord.WdSaveFormat.wdFormatDocument; object LockComments = false;object Password = missingValue;object AddToRecentFiles = false;object WritePassword = missingValue;object ReadOnlyRecommended = false;object EmbedTrueTypeFonts = true;object SaveNativePictureFormat = missingValue;object SaveFormsData = missingValue;object SaveAsAOCELetter = missingValue;object Encoding = missingValue;object InsertLineBreaks = missingValue;object AllowSubstitutions = missingValue;object LineEnding = missingValue;object AddBiDiMarks = missingValue;object CompatibilityMode = missingValue;doc.SaveAs(ref targetFileName, ref FileFormat,ref LockComments, ref Password, ref AddToRecentFiles, ref WritePassword,ref ReadOnlyRecommended, ref EmbedTrueTypeFonts, ref SaveNativePictureFormat, ref SaveFormsData,ref SaveAsAOCELetter, ref Encoding, ref InsertLineBreaks, ref AllowSubstitutions,ref LineEnding, ref AddBiDiMarks);//doc.SaveAs(ref targetFileName, ref FileFormat, //        ref MissingValue, ref MissingValue, ref MissingValue, ref MissingValue, //        ref MissingValue, ref MissingValue, ref MissingValue, ref MissingValue, //        ref MissingValue, ref MissingValue, ref MissingValue, ref MissingValue, //        ref MissingValue, ref MissingValue);wordApp.Documents.Close(ref missingValue, ref missingValue, ref missingValue);//关闭进程object saveOption = msWord.WdSaveOptions.wdDoNotSaveChanges;wordApp.Application.Quit(ref saveOption, ref missingValue, ref missingValue);
}

Office之Docx转Doc操作(c#)相关推荐

  1. word操作之docx转doc出现公式变图片问题的解决方案

    很多基于word的在线文档提交系统,如各类申报书提交系统经常要求上传doc格式(word 97-2003)的文件.然而目前word最常用版本的后缀名为docx,在docx转为doc时,常常会出现公式变 ...

  2. office办公文档doc、docx、xls、xlsx、ppt、pptx在线预览解决方案一,背景

    office办公文档doc.docx.xls.xlsx.ppt.pptx在线预览解决方案 office办公文档doc.docx.xls.xlsx.ppt.pptx无法直接在浏览器中打开,很多OA办公软 ...

  3. 使用jacob将docx转换为doc,遇到各种坑,一一为大家填好

    项目要导出word,用的poi的XWPF各种调试生成了一个比较复杂的word文档,用wps打开没问题,但是用office表格就乱了,各种捣鼓,才知道XWPF生成的是word2007,word97·20 ...

  4. .docx,.doc,.pptx,.ppt,.xlsx,.pdf后缀文档图标不显示

    .docx,.doc,.pptx,.ppt,.xlsx五种操作类似. 一 .docx与.doc 1.Win+R,输入regedit,回车: 2.对于 Word 2007/Word 2010,备份并删除 ...

  5. 某高校计算机系举办了一场,国家二级MS+OFFICE高级应用机试(操作题)-试卷25

    国家二级MS OFFICE高级应用机试(操作题)-试卷25 (总分:6.00,做题时间:90分钟) 一. Word字处理软件的使用(总题数:1,分数:2.00) 1.请在"答题"菜 ...

  6. 使用java将word文档docx,doc(包含图形,文本框)完美转换成所有格式图片(pdf,png,gif,jpeg等等)

    使用java将word文档docx,doc(包含图形,文本框,图片等)完美转换成所有格式图片(pdf,png,gif,jpeg等等)下文中附带代码,效果图等 思路 使用到的包 实现代码 效果图: 思路 ...

  7. python docx与doc 文件互相转换

    因文件格式要求,需要将docx 与doc文件相互转换,特寻找python代码,与大家共分享 from win32com import client#转换doc为docx def doc2docx(fn ...

  8. doc转docx文件会乱吗_docx怎么转换成doc?docx转doc方法汇总

    word2003,又不想安装word2007以上的新版本,怎么办?docx怎么转换成doc? 下面,Office办公助手小编给大家两种简单易行的方法,不用安装庞大的word2007或者word2010 ...

  9. Word处理控件Aspose.Words功能演示:在 Python 中将 Word DOCX 或 DOC 转换为 PDF

    Word 到PDF是最流行和执行最广泛的文档转换之一.DOCX或DOC文件在打印或共享之前会转换为 PDF 格式.在本文中,我们将在 Python 中自动将 Word 转换为 PDF.步骤和代码示例将 ...

最新文章

  1. firefox浏览器中silverlight无法输入问题
  2. android离线宝,Android 离线安装宝典
  3. Java熔断框架有哪些_降级熔断框架 Hystrix 源码解析:滑动窗口统计
  4. win7 64安装工商网银U盾软件
  5. mysql从删库到跑路 亚马逊_Amazon RDS 上的 MySQL 的已知问题和限制 - Amazon Relational Database Service...
  6. Qt在线/离线安装包下载网址和说明
  7. 【渝粤教育】广东开放大学 hadoop数据管理 形成性考核
  8. Paxos算法在大型系统中常见的应用场景
  9. git 修改密码_在windows中利用gitblit搭建git服务端
  10. Origin安装Could not connect to Internet Origin installation requires an Internet Connection
  11. Verilog实现按键消抖
  12. 华为P40怎么解账号锁P40Pro忘记密码ID账号锁解除方案开机设备解锁帐号软件使用方法
  13. 少儿编程 电子学会图形化编程等级考试Scratch三级真题解析(判断题)2022年6月
  14. 计算机网络——模拟信号(四)
  15. 桌面计算机图标怎么取消,win7图标箭头怎么取消,win7去除电脑桌面图标箭头
  16. 计算机音乐红色彼岸花,《抖音》红色彼岸花花瓣遍地撒是什么歌
  17. python 二进制与十进制之间的转换
  18. 【图文详解】canvas插件安装方法及常用插件推荐
  19. Logstash 时区问题
  20. 第十三届蓝桥杯 EDA 设计与开发科目 模拟试题(详细解读)

热门文章

  1. Django admin后台管理页面的常用设置
  2. 服务器信息列表下架关闭,龙王传说服务器关闭下架公告
  3. android怎么调起记事本,安卓手机上怎么找到便签或记事本?
  4. 交易系统开发(十)——FIX协议
  5. 回头看singleton(单件)
  6. 办公室日常管理信息系统 数据库课程设计
  7. 键盘只能按一次解决方案
  8. C语言将信息保存到文件中
  9. ios 9 10 11 air mirror 交互协议
  10. 别玩手机了,你没时间了!