Hallo, ich war "schlampig" und habe das gepostete Makro nicht getestet. Es ist fehlerhaft. Das hier sollte funktionieren:
Sub test xxx = ThisComponent.StyleFamilies.getByName("ParagraphStyles") cursor = ThisComponent.text.CreateTextCursor cursor.GotoStart(False) For i = 0 to xxx.Count-1 ndf = Trim(xxx.GetByIndex(i).DisplayName) alles = "" For j=1 to Len(ndf) teil = Left(ndf,j) teil2 = Right(teil,1) if teil2 = " " Then teil2 = "_" if Teil2 = "ö" Then Teil2 = "oe" if Teil2 = "ü" Then Teil2 = "ue" if teil2 = "ä" Then Teil2 = "ae" If teil2 = "Ö" Then teil2 = "Oe" If teil2 = "Ü" Then teil2 = "Ue" If teil2 = "Ä" Then teil2 = "Ae" If teil2 = "ß" Then teil2 = "ss" alles = alles & teil2 Next j if alles = "Text" Then alles = "_Text" Cursor.String = "Sub " & alles Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) Cursor.String = " SetCurrentParaStyle(" & CHR(34) & _ xxx.GetByIndex(i).Name & CHR(34) & ")" Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) Cursor.String = "End Sub" Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) Next i Cursor.String = "Function SetCurrentParaStyle (NewStyle)" Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) Cursor.String = _ " thisComponent.currentcontroller.getViewCursor" & _ ".paraStyleName = NewStyle" Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) Cursor.String = "End Function" Cursor.GotoEndofParagraph(False) ThisComponent.Text.insertControlCharacter(Cursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) End sub Gruß Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]