Page 1 of 1

Can I identify the paragraph number?

Posted: Sun Nov 06, 2022 9:13 am
by HansVanTilburg
My CAT tool https://www.cafetran.com uses LibreOffice Writer as a preview tool: https://youtu.be/PVqzHF6uxYo

There is an issue when a documents contains several instances of the same paragraph:

======
Introduction

Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.

Introduction

Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.Blablabbla. Blablabbla, blablabbla.
======

Is there anyway to differentiate between the instances of the same paragraph? BTW: I'm not sure what automation tool the developer used for controlling Writer from CafeTran Espresso. It must be one that is cross platform.

Thank you in advance for your input!
Hans

Re: Can I identify the paragraph number?

Posted: Sun Nov 06, 2022 11:47 am
by JeJe
If you use MRI to have a look you'll see that each paragraph has its own identifying ID - localname/metadatareference/stringvalue

Edit:
Note: the same ID may not persist when the document is closed and reopened.

Re: Can I identify the paragraph number?

Posted: Sun Nov 06, 2022 12:22 pm
by RoryOF
Nor mght it persist if the file is edited, particularly if editing is done before the object paragraph.

Re: Can I identify the paragraph number?

Posted: Sun Nov 06, 2022 1:31 pm
by JeJe
Its real easy to get all the non-empty paragraph ranges with a find all, if that's any help...

Code: Select all


 vDescriptor = ThisComponent.createSearchDescriptor()
 With vDescriptor
 .SearchString = ".*"
 .SearchRegularExpression = true
 End With
 vFound = ThisComponent.findall(vDescriptor)
 msgbox vfound.count
 msgbox vfound(3).string 'fourth NON-EMPTY paragraph string