How to find the "Default" paragraph style

View: New views
3 Messages — Rating Filter:   Alert me  

How to find the "Default" paragraph style

by pitonyak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to know the name of the "Default" paragraph style. I would also
like to find the "Default" paragraph style.

I am using "en" language in the USA.

Consider code such as the following:

  oStyles = oDoc.StyleFamilies.getByName("ParagraphStyles")
  sss = "Default"
  sss = "Standard"
  If oStyles.hasByName(sss) Then
    Print "is the name " & sss & " = " & oStyles.getByName(sss).Name
  End If

This prints:

is the name Default = Standard

OK, so the the GUI uses the name Default, the container is able to find
a style named Default, but the returned style is really named Standard.
If I check the names, it says Standard, not Default.

How do I find the name of the Default paragraph style? My inclination is
to use oStyles.getByIndex(0)

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to find the "Default" paragraph style

by Bernard Marcelly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrew,
A style has an internal name and a localized display name.
A custom style has the same internal name and display name.

Built-in styles may have a display name different from the internal name.

The built-in paragraph style with internal name : "Standard" has a
display name "Default" in english locale.
In french locale, the display name is "Standard" ...

Method getName() returns the internal name of a style.
Property DisplayName contains the displayed name.


Dim paragStyles As Object, aStyle As Object
paragStyles = ThisComponent.StyleFamilies.getByName("ParagraphStyles")
aStyle = paragStyles.getByName("Standard")
MsgBox(aStyle.DisplayName, 0, "Displayed style name")

Regards
   Bernard



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to find the "Default" paragraph style

by pitonyak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Bernard...

I will change my code to use the "display" name rather than the internal
name.

Bernard Marcelly wrote:
> Hi Andrew,
> A style has an internal name and a localized display name.
> A custom style has the same internal name and display name.
<snip>

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...