Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I replace text in a DOCX file?
QtWS25 Last Chance

How can I replace text in a DOCX file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5.15wordlibrary
7 Posts 4 Posters 1.2k Views
  • 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.
  • S Offline
    S Offline
    sm-a
    wrote on 10 Jan 2021, 22:58 last edited by
    #1

    I am new to Qt and hope I get an answer.
    How can I replace text in a DOCX file? What library do I need. Best would be free (library). If possible give me an example to see how the library works.

    Thank you for help.

    J A 2 Replies Last reply 11 Jan 2021, 06:33
    0
    • S sm-a
      10 Jan 2021, 22:58

      I am new to Qt and hope I get an answer.
      How can I replace text in a DOCX file? What library do I need. Best would be free (library). If possible give me an example to see how the library works.

      Thank you for help.

      J Offline
      J Offline
      JonB
      wrote on 11 Jan 2021, 06:33 last edited by
      #2

      @sm-a
      There is nothing Qt for this. You won't get a suggestion for a library if you don't say say what programming language you are using. C++, Python?

      1 Reply Last reply
      3
      • C Offline
        C Offline
        ChrisW67
        wrote on 11 Jan 2021, 08:17 last edited by
        #3

        If your application is running on a machine with Microsoft Word installed then you can automate it with ActiveQt.

        Depending on the the complexity of the task you could unzip the DOCX file, modify the word/document.xml file it contains, and then zip up the result.

        1 Reply Last reply
        4
        • S sm-a
          10 Jan 2021, 22:58

          I am new to Qt and hope I get an answer.
          How can I replace text in a DOCX file? What library do I need. Best would be free (library). If possible give me an example to see how the library works.

          Thank you for help.

          A Offline
          A Offline
          Asperamanca
          wrote on 11 Jan 2021, 12:40 last edited by Asperamanca 1 Nov 2021, 12:40
          #4

          Unless you have other reasons to use Qt for this, I would consider using .NET. The library support for something like this should be much better there.

          1 Reply Last reply
          1
          • S Offline
            S Offline
            sm-a
            wrote on 13 Jan 2021, 16:32 last edited by
            #5

            I use C++ as programming language. The application must be platform independent.

            The solution for me is to write a .NET CORE application with the "DocumentFormat.OpenXml" library which is platform independent. Then I simply run this application under each platform to replace text.

            Thanks for your help.

            J 1 Reply Last reply 13 Jan 2021, 16:58
            0
            • S sm-a
              13 Jan 2021, 16:32

              I use C++ as programming language. The application must be platform independent.

              The solution for me is to write a .NET CORE application with the "DocumentFormat.OpenXml" library which is platform independent. Then I simply run this application under each platform to replace text.

              Thanks for your help.

              J Offline
              J Offline
              JonB
              wrote on 13 Jan 2021, 16:58 last edited by
              #6

              @sm-a
              As you please, but doesn't running a .NET CORE application on each target platform require quite some installation/dependencies?

              S 1 Reply Last reply 13 Jan 2021, 20:06
              0
              • J JonB
                13 Jan 2021, 16:58

                @sm-a
                As you please, but doesn't running a .NET CORE application on each target platform require quite some installation/dependencies?

                S Offline
                S Offline
                sm-a
                wrote on 13 Jan 2021, 20:06 last edited by
                #7

                Yes @JonB, it requires depencencies but this is not a problem. I will install this automaticly after users choice.

                You can find them under:
                LTS RELEASE
                https://dotnet.microsoft.com/download/dotnet-core/3.1

                Current release
                https://dotnet.microsoft.com/download/dotnet/5.0

                Note: .net CORE works with Linux, macOS und Windows.

                1 Reply Last reply
                0

                1/7

                10 Jan 2021, 22:58

                • Login

                • Login or register to search.
                1 out of 7
                • First post
                  1/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved