AutoCorrect Service
AutoCorrect Service
Hi OO Forum,
I'm stuck with implementation of AutoCorrect function using UNO API to work with LibreOffice Writer.
Is there a service or solution to perform same action as Tools -> AutoCorrect -> Apply.
This question is certainly a part of this topic: viewtopic.php?f=20&t=86979.
However there is no answer there regarding AutoCorrect.
Thanks.
I'm stuck with implementation of AutoCorrect function using UNO API to work with LibreOffice Writer.
Is there a service or solution to perform same action as Tools -> AutoCorrect -> Apply.
This question is certainly a part of this topic: viewtopic.php?f=20&t=86979.
However there is no answer there regarding AutoCorrect.
Thanks.
LibreOffice 7.2.7 x64 on Windows 10 x64
Re: AutoCorrect Service
AutoCorrect and AutoComplete intervene while you are typing. How could this be useful in a macro?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: AutoCorrect Service
I guess it's useful because there is such option to apply autocorrection for existing text in LibreOffice itself, isn't it?
E.g. insert already preformatted text (*text*, _text_, -text-) into range and apply autocorrection afterwards.
Btw the question is not about macro but about UNO API service.
I foresee answer about macro recording.
However DispatchHelper is no go for me.
E.g. insert already preformatted text (*text*, _text_, -text-) into range and apply autocorrection afterwards.
Btw the question is not about macro but about UNO API service.
I foresee answer about macro recording.
However DispatchHelper is no go for me.
Code: Select all
sub Autocorrect
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:AutoFormatApply", "", 0, Array())
end sub
LibreOffice 7.2.7 x64 on Windows 10 x64
Re: AutoCorrect Service
If you want to manipulate strings, you do not need any office suite. A mature script language like Perl or Python does a much better job.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: AutoCorrect Service
Also, unsupervised autocorrect might leave a document in a less intelligible state than originally. Any potential autocorrection will need intelligent steering if multiple choices are offered.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: AutoCorrect Service
That looks like a markup language like Markdown. Is what you want to do here just a series of find/replace in code? That doesn't need autocorrect...E.g. insert already preformatted text (*text*, _text_, -text-) into range and apply autocorrection afterwards.
Edit: I started the thread you linked to in your opening post because I wanted to implement autocorrect in dialog textboxes. I couldn't work out how to access the autocorrect list of words (except the file where they're stored) and I ended up writing my own separate replacement autocorrect code for textboxes using a collection object to store the list of words.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: AutoCorrect Service
I have just mentioned simplest use case in order to answer the question "Why?".
What I want is to use all existing AutoCorrect features if it is possible.
What I want is to use all existing AutoCorrect features if it is possible.
LibreOffice 7.2.7 x64 on Windows 10 x64
Re: AutoCorrect Service
If the answers remains... (as per that previous thread)... that no-one here knows how to access the autocorrect... and maybe you just can't... what are you trying to do exactly? I'm asking so we can perhaps help you solve the problem in a different way.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
- Hagar Delest
- Moderator
- Posts: 32661
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: AutoCorrect Service
To do something like in this topic: [Solved] Taking note and tagging format?John23 wrote:E.g. insert already preformatted text (*text*, _text_, -text-) into range and apply autocorrection afterwards.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Re: AutoCorrect Service
The examples look like Markdown. https://rmarkdown.rstudio.com/docs/refe ... ument.html https://products.aspose.app/words/conversion/md-to-odt
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: AutoCorrect Service
Just for information: the acor_en-GB.dat file (modify according to language used) is a zip file; it contains several .xml files of which DocumentList.xml seems to be the file with the match words and their suggested replacements. It is in alphabetical order.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: AutoCorrect Service
No need to hold to that example so much.
What I need is to support ALL the rules from built in AutoCorrect options.
Perhaps even user defined, that was added through application.
I'm building framework on top of UNO API to work with LibreOffice to generate reports.
Input text is black box for me. I don't have an info about what rules exactly from AutoCorrect I need.
If I knew that, I would have implemented a simple replace function.
What I need is to support ALL the rules from built in AutoCorrect options.
Perhaps even user defined, that was added through application.
I'm building framework on top of UNO API to work with LibreOffice to generate reports.
Input text is black box for me. I don't have an info about what rules exactly from AutoCorrect I need.
If I knew that, I would have implemented a simple replace function.
LibreOffice 7.2.7 x64 on Windows 10 x64
Re: AutoCorrect Service
Yeah, this is a very good point of revising the idea itself.RoryOF wrote:Also, unsupervised autocorrect might leave a document in a less intelligible state than originally. Any potential autocorrection will need intelligent steering if multiple choices are offered.
I guess I will end up with some custom replacement function after all.JeJe wrote:Edit: I started the thread you linked to in your opening post because I wanted to implement autocorrect in dialog textboxes. I couldn't work out how to access the autocorrect list of words (except the file where they're stored) and I ended up writing my own separate replacement autocorrect code for textboxes using a collection object to store the list of words.
Thanks.
LibreOffice 7.2.7 x64 on Windows 10 x64
Re: AutoCorrect Service
One could open DocumentList.xml, parse it into a Python 'dict' structure, then pass through the test file making lookups and replacements from the Python dictionary just built. That would be the first step. Then one could examine the other files in acor_en-GB.dat and consider implementing their changes, integrating with the file pass-through code already written.
I'm not a Python expert, but I think that language would lend itself better to the project than BASIC.
I'm not a Python expert, but I think that language would lend itself better to the project than BASIC.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: AutoCorrect Service
An alternative auto-correct system shouldn't be too hard - a keyhandler to look at what's typed against a list of replacements - then replace appropriately, with a dialog to edit the word list.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: AutoCorrect Service
@RoryOF, @JeJe, thanks for your suggestions.
I'll give it a try.
I'll give it a try.
LibreOffice 7.2.7 x64 on Windows 10 x64