Monday, June 3, 2019

Replace words in word or rtf

https://www.swissdelphicenter.ch/en/showcode.php?id=1440

https://stackoverflow.com/questions/8148899/insert-rtf-text-in-a-word-document

http://www.delphibasics.co.uk/RTL.asp?Name=stringreplace

MORE TIPS:

https://superuser.com/questions/557023/changing-the-default-ansi-to-utf-8-in-notepad

https://www.iditect.com/tutorial/word-find-replace-text/

******
So, on windows systems it is possible to set a “hook” using the SetWindowsHookExA function provided by user32.dll.
This mechanism is functionally implemented as a hook procedure set to one hook type (mouse clicks, keyboard input) and manages these via a hook chain (a list of pointers to the hook procedure).
Most keylogger use that mechanism, and you can use Python, C#, Delphi or Lazarus-ide to read all that “hooks”. There are plenty samples on internet.
Don’t trust to some freeware and shareware, and do not believe in ready-made tools.
The best tools are that you create and compile.

How to Replace Text in Docx Document in C# language

This C# tutorial shows how to replace old text in MS Word file to the new text content.
First you need to choose the old text in the .docx document, then set the new text you want to replace.
There are two parameters Optional:
  • matchCase - whether the casing should be matched.
  • matchWholeWord - whether only whole words should be matched.
WordFile wordFile = new WordFile();
WordDocument document = wordFile.Import(File.ReadAllBytes("Sample.docx"));

WordDocumentBuilder builder = new WordDocumentBuilder(document);

//Replace target text in whole document, match-case and match-whole-word are supported
builder.ReplaceText("Page", "as", true, true);

File.WriteAllBytes("ReplaceText.docx", wordFile.Export(document));

No comments:

Post a Comment

Коментар: