Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. c# windows application Working with Microsoft Office Word

c# windows application Working with Microsoft Office Word

Scheduled Pinned Locked Moved C#
csharpwinformscomtools
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zeyad Jalil
    wrote on last edited by
    #1

    Hi, We have a C# windows forms application and I need to work with MS Word files to replace some text, table rows content, or add a new rows to an existed table, we need to know the best way. I tried using Microsoft.Office.Interop.Word but this way may be old and must use the same office on the all pc's you install the application on it, if you use the MS Office 2007 then you must install it on any PC will use the application. Please let me know the best way, tools to do that. Thank You

    OriginalGriffO D M pkfoxP 4 Replies Last reply
    0
    • Z Zeyad Jalil

      Hi, We have a C# windows forms application and I need to work with MS Word files to replace some text, table rows content, or add a new rows to an existed table, we need to know the best way. I tried using Microsoft.Office.Interop.Word but this way may be old and must use the same office on the all pc's you install the application on it, if you use the MS Office 2007 then you must install it on any PC will use the application. Please let me know the best way, tools to do that. Thank You

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Basically, interop is pretty much your only real way - but using Word as a storage medium is the real problem! There are various libraries that claim to do it - Google found this which lists a few: Reading doc and docx files using C# without having MS Office installed on server - Stack Overflow[^] - but I've not tested any. Personally, I'd look for a better file format - there is no guarantee that what you read today will stay the same format tomorrow if MS decide to "add features".

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • Z Zeyad Jalil

        Hi, We have a C# windows forms application and I need to work with MS Word files to replace some text, table rows content, or add a new rows to an existed table, we need to know the best way. I tried using Microsoft.Office.Interop.Word but this way may be old and must use the same office on the all pc's you install the application on it, if you use the MS Office 2007 then you must install it on any PC will use the application. Please let me know the best way, tools to do that. Thank You

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        If you can use the newer Office formats, you can use the OpenXML SDK to work with the files without having Office installed.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        1 Reply Last reply
        0
        • Z Zeyad Jalil

          Hi, We have a C# windows forms application and I need to work with MS Word files to replace some text, table rows content, or add a new rows to an existed table, we need to know the best way. I tried using Microsoft.Office.Interop.Word but this way may be old and must use the same office on the all pc's you install the application on it, if you use the MS Office 2007 then you must install it on any PC will use the application. Please let me know the best way, tools to do that. Thank You

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          Interop is the only real method of updating Word. We had to make sure ALL users were on EXACTLY the same version of Word to use the application. It was updating legal documents that had to read exactly correctly and turned out to be one of the most painful operations I have ever had to do. If you cannot control the version of Word on all clients then you have a serious problem.

          Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

          1 Reply Last reply
          0
          • Z Zeyad Jalil

            Hi, We have a C# windows forms application and I need to work with MS Word files to replace some text, table rows content, or add a new rows to an existed table, we need to know the best way. I tried using Microsoft.Office.Interop.Word but this way may be old and must use the same office on the all pc's you install the application on it, if you use the MS Office 2007 then you must install it on any PC will use the application. Please let me know the best way, tools to do that. Thank You

            pkfoxP Offline
            pkfoxP Offline
            pkfox
            wrote on last edited by
            #5

            Check out NPOI [GitHub - dotnetcore/NPOI: A .NET library for reading and writing Microsoft Office binary and OOXML file formats.](https://github.com/dotnetcore/NPOI) I've used it a lot for Excel .xlsx files and it's always got the job done. They give you sample code that cover most common scenarios.

            "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups