each paragraph to its own string marker(name)

Hello!
I have this code, which writes out in msgbox all the paragraphs in the text we put in writer, one after another:

Sub k 

     oParEnum = ThisComponent.getText.createEnumeration 
     Do While oParEnum.hasMoreElements() 

            oPar = oParEnum.nextElement()  
            print oPar.getString

Loop 
End Sub

Please, I am trying to put each paragraph into ints own line
SO THAT I PUT AECH PARTICULAR PARAGRAPH TO A PARTICULARY NAMED STRING.


It means, if text in writer had 3 paragraphs,

I would put first paragraph to string a1

second paragraph to string a2

and third paragraph to string a3


I am trying hardy to understand the syntax, cause I am meeting this for the first time and that is the first example of this I ever did.

Please, if anyone can help with any advice, I would appreciate!


Many thanks!!!

global x as integer
global a(x) as string

Sub k 
   x=0
   

   oParEnum = ThisComponent.getText.createEnumeration 
   Do While oParEnum.hasMoreElements() 

       oPar = oParEnum.nextElement()  
       x=x+1
       a(x)=oPar
       print oPar.getString

    Loop 
End Sub

Sub k2
    msgbox(a3)
End Sub

Could you possibly give an example of what you want to do in which LibO application?

Hello!
Want each paragraph to put to another particular string, which I can use later for other things.

Solved!!!

This is not an answer. Please edit your question with additional information or use comments to respond to comments. Also, if you managed to solve your question, please answer it so that others can learn too.