Page 1 of 1

Action to search and replace in Author mode

Posted: Sat Dec 14, 2019 1:48 am
by mboudreau
Is it possible to create Actions that find and replace text throughout an entire document in Author mode? For example, changing multiple spaces to a single space. I know this is easy to do using the Find dialog, but I'd like to be able to assign frequently used replace-all operations to a toolbar button.

Re: Action to search and replace in Author mode

Posted: Mon Dec 16, 2019 11:34 am
by Radu
Hi,

Again, maybe you can do this with a custom JSOperation calling Javascript code which performs various changes on the opened document:

https://github.com/oxygenxml/javascript ... operations

Or you can create a custom Java operation which uses the API for the same purpose.

We have Java API to create a text iterator over the entire content:

ro.sync.ecss.extensions.api.AuthorDocumentController.getTextContentIterator(int, int)

https://www.oxygenxml.com/InstData/Edit ... r-int-int-

Sample usage:

https://github.com/sbsdev/dtbook-author ... ation.java

Regards,
Radu