c# 打开word

添加using System.Reflection; using Microsoft.Office.Interop.Word; 引用

在d盘下建立1.doc文档作为测试 

string filepath = "D://1.doc";             Microsoft.Office.Interop.Word.Application oword = new Microsoft.Office.Interop.Word.Application();           //  oword.Documents = new Microsoft.Office.Interop.Word.Document();  

           //oword.Documents= oword.Application.Documents.Open(filepath, ref Missing.Value , System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value);             Object filename = filepath;             Object ConfirmConversions = false;             Object ReadOnly = false;             Object AddToRecentFiles = false;             Object PasswordDocument = System.Type.Missing;             Object PasswordTemplate = System.Type.Missing;             Object Revert = System.Type.Missing;             Object WritePasswordDocument = System.Type.Missing;             Object WritePasswordTemplate = System.Type.Missing;             Object Format = System.Type.Missing;             Object Encoding = System.Type.Missing;             Object Visible = System.Type.Missing;             Object OpenAndRepair = System.Type.Missing;             Object DocumentDirection = System.Type.Missing;             Object NoEncodingDialog = System.Type.Missing;             Object XMLTransform=System.Type.Missing;             oword.Documents.Open(ref filename, ref ConfirmConversions,             ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,             ref Revert, ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,             ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection, ref NoEncodingDialog, ref XMLTransform);             //wordDoc = wordApp.Documents.Open(ref filename, ref ConfirmConversions,             //ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,             //ref Revert,ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,             //ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection, ref NoEncodingDialog);               oword.Visible = true; 调试成功!

总结一下,如果调用用原来的excel的System.Reflection.Missing.Value默认缺省值就不行,调用word的时候必须使用System.Type.Missing默认缺省值。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
关于"快速气动应用机器人"(Cobot)的问题,Cobot是一种新型的机器人技术,它结合了传统机器人和人类操作员的技能和能力。Cobot能够与人类工作人员共享同一个工作空间,并与他们紧密合作。这种机器人的目标是提高生产效率和减少人员受伤的风险。 Cobot的一个显著特点是它的快速响应能力。它可以在短时间内完成复杂的任务,并且可以根据实时情况进行调整。例如,在汽车制造工厂中,Cobot可以与工人一起组装汽车零部件,它可以根据工人的指令和需求来调整自己的行动,快速适应变化的生产需求。 Cobot还具有高度的灵活性和可编程性。它可以通过编程来完成各种任务,并且可以根据需要进行快速的配置和重新配置。这使得Cobot能够在不同的工作环境和任务中发挥作用,从而提高生产效率和灵活性。 此外,Cobot还具有安全性能。它可以感知周围的环境,并根据需要进行安全控制。当Cobot与人类工作人员共同工作时,它可以识别和避免潜在的碰撞或危险情况,确保工作场所的安全。 总的来说,Cobot是一种创新的机器人技术,它能够快速响应和适应各种复杂的任务,并与人类工作人员紧密合作。它具有高度的灵活性和可编程性,可以在不同的工作环境和任务中发挥作用。此外,Cobot还具有安全性能,能够保证工作场所的安全。这些优点使得Cobot在工业生产和其他领域中有着广泛的应用前景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值