Hi,

> Hi all,
> 
> Some time ago I posted a question about lists in Writer documents, and I
> am still having problems. I thought I'd simplify the question and
> re-post now.
> 
> How can I get the actual text string of a numbered list item? Calling
> getString() on a TextCursor or Paragraph returns the numbering character
> as well, so e.g.
> 
> foobar        <--- Paragraph.getString() returns "foobar"
> - foobar      <--- Paragraph.getString() returns "foobar"
> 1. foobar     <--- Paragraph.getString() returns "1.foobar"
> 
> Because the numbering character and delimiter can be more or less
> anything (if user-defined), it's impossible to universally strip them
> off (especially as the delimiter can be omitted).
> 
> Is there any way of getting just the string? Any help will be greatly
> appreciated, as I really need this and I've been going in circles with
> the issue.
> 

I think you've to enumerate your Paragraph:

'-------------------------
sub testParaNumberRules
   doc = thiscomponent
   texto = doc.getText()
   enum = texto.createEnumeration()
   while enum.hasMoreElements()
      txt = enum.nextElement()
      nrules = txt.NumberingRules
      if not IsEmpty(nrules) Then
         enum2 = txt.createEnumeration()
         paraString = ""
         ' get all TextPortions
         while enum2.hasMoreElements()
            portion = enum2.nextElement()
            paraString = paraString & portion.getString()
         wend
         print paraString
      end if
   wend
end sub
'-------------------------

Here's a issue about:
http://www.openoffice.org/issues/show_bug.cgi?id=68511

HTH

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to