Saving Word document

后端 未结 3 993
误落风尘
误落风尘 2021-01-21 18:32

I would like to save a Word document according to the Word installed version;

In case it is Word 2003 (appropriate version number is 11), with DOC exten

相关标签:
3条回答
  • 2021-01-21 18:46

    Not sure the API is exactly the same between different word versions.

    If I can make a suggestion - use NetOffice( see link) instead of the office interop assemblies.

    the API is the same as the Office Interop API, and it will work with all (current) versions of Microsoft Office.

    NB - Here is a sample: http://netoffice.codeplex.com/wikipage?title=Word_Example01

    You should import the following namespaces to get it to work:

    using NetOffice;
    using Word = NetOffice.WordApi;
    using NetOffice.WordApi.Enums;
    using Office = NetOffice.OfficeApi;
    
    0 讨论(0)
  • 2021-01-21 18:51

    That is because you use the wrong version of the interop assemblies. You cannot reference a value which only exists in higher versions of the framework.

    You should use a higher interop version, or create two separate projects, one for the older version of the interop assemblies, one for the higher versions.

    0 讨论(0)
  • 2021-01-21 18:53

    Use the following project's code base to create and save ms word using c#: https://github.com/kauser-cse-buet/NetOfficeUsage

    0 讨论(0)
提交回复
热议问题