OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to get a Writer heading string without number?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
harrybo
Power User
Power User


Joined: 27 Apr 2004
Posts: 75
Location: Germany

PostPosted: Tue Nov 16, 2004 2:20 am    Post subject: How to get a Writer heading string without number? Reply with quote

Hello,

to extract the structure of a Writer document, I iterate through it by checking the ParaStyleName property of each paragraph. To stop at each paragraph that is a heading, I wrote the following function:
Code:
function SetNextHeading() as boolean
dim vParagraph as object
dim vStyle as string
  SetNextHeading = false
  While goEnum.hasMoreElements() 
    goPara = goEnum.nextElement()
    If goPara.supportsService("com.sun.star.text.Paragraph") Then
      vStyle = Left(goPara.ParaStylename, 7)
      if vStyle = "Heading" then
        SetNextHeading = true
        exit function
      end if
    end if   
  wend
end function

where goEnum is a global Enumeration object. The paragraph.GetString method now gives me the title of the found heading, but the string also contains the numbering (such as "1.2This is a subchapter ").

The question: How can I separate numbering and title (note: a title can be "101 Dalmatiner")?

Thank you,

Harry
Back to top
View user's profile Send private message Send e-mail Visit poster's website
harrybo
Power User
Power User


Joined: 27 Apr 2004
Posts: 75
Location: Germany

PostPosted: Fri Nov 19, 2004 2:00 am    Post subject: Reply with quote

Please help,

I'm still looking for a solution since 3 days now and it nearly drives me crazy. The question seems to be simple: What are the chapter titles of a Writer document? With the code, I posted, I can get the full titles what means, they start with the chapter-numbering.

I need the chapter-titles without the chapter-numbering!

thank you

Harry
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group