loops while oFound is none of None, 0, False, empty string, empty dictionary, empty list, empty tuple.
Are you sure you want to program complex things in Python without knowing the language?
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
com.sun.star.uno.RuntimeException (Error during invoking function PlainToHTML2 in module file:///usr/lib/libreoffice/share/Scripts/python/PlainToText2.py (<class 'uno.com.sun.star.lang.IllegalArgumentException'>:
/usr/lib/libreoffice/share/Scripts/python/PlainToText2.py:98 in function FormatWorker() [if oDoc.Text.compareRegionEnds(oFound, oRCurs)>=0:]
/usr/lib/libreoffice/share/Scripts/python/PlainToText2.py:43 in function PlainToHTML2() [FormatWorker(oCurs[i][0], oCurs[i][1], model, ".*")]
/usr/lib/libreoffice/program/pythonscript.py:870 in function invoke() [ret = self.func( *args )]
))
It happens, becouse oFound does not contains result. How can I solve this problem?
I undestanded. It is other error. I use compareRegionEnds as condition for break in search results processing loop. I need it for search in selected text only. If oFound is table data, i have error in compareRegionEnds function.
How i can solve this problem? I need detect paragraph data in loop. This issue was discussed here viewtopic.php?f=45&t=6756 but no solutions there
Table cells have their own text object, independent from the document main text object. Therrefore you can't compare their starts and ends.
If the found string is inside a table cell, the property "TextTable" points to the table, which have an anchor attached to the main text (if not in an other table or frame of course). Then you can compare start and end of the table anchor with the ones of your selection.
Hope this can help...
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
It helps me to detect table data. What is about Frames and other data types? I need universal solution for every cases. I need detect simple text data only.
You can check for an in-frame text with the property TextFrame. Text within shapes, as far as I know, are not considered by the methods "findXXX".
I don't see right now other object that might embed his own text objects.
Much simpler by the way, you may try comparing text objects :