How can I replace text in a DOCX file?
-
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.
-
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.
-
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.
-
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.1Current release
https://dotnet.microsoft.com/download/dotnet/5.0Note: .net CORE works with Linux, macOS und Windows.