On Fri, 2005-03-11 at 04:45, Jonathon Blake wrote:
> Mike wrote:
> 
> > Longer term idea - might it be useful to have the ability to list
>  resources of one sort or another used in a document?  
> 
> I don't remember which of Ian's macros it is, but one can be easily
> converted to do that.
> 
> >I'm thinking particularly of fonts of course, but also colours used
> and maybe there are other things too.
> 
> Ian wrote a macro for me that listed the fonts and languages that  I
> used in a document.  :)
> 
> He didn't think anybody else would be interested in it, so I doubt he
> still has the code.
> 

Here is the relevant portion of the email that I sent Jonathon :-).

> Does anybody know of an easy way to find which of several hundred
> styles uses a specific language?
> 
I just wrote this macro while waiting for the evening meal to cook. It
adds the details of languages of the paragraph styles at the end of the
document. It is a bit rough and ready but I think it should do the job:

Sub Main
dim mApiNames, nStyles as integer, i as integer
dim oStyles, oStyle, oDoc, oText

oDoc = thisComponent
oText = oDoc.text
oStyles = oDoc.styleFamilies.getByName("ParagraphStyles")
mApiNames = oStyles.ElementNames
nStyles = uBound(mApiNames)

oText.insertString(oText.end,"Language" & chr(9) & "Country" & chr(9) _ 
& "Variant", false)
oDoc.Text.insertControlCharacter(oText.end,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
for i = 0 to nStyles
 oStyle =  oStyles.getByIndex(i)
 oText.insertString(oText.end, oStyle.DisplayName & chr(9), false)
 oText.insertString(oText.end, oStyle.charLocale.Language & chr(9), _
false)
 oText.insertString(oText.end, oStyle.charLocale.Country & chr(9), _
false)
 oText.insertString(oText.end, oStyle.charLocale.variant, false)
 oDoc.Text.insertControlCharacter(oText.end, _
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
next
end sub 

Hope it helps - Ian



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

Reply via email to