0
  • I would like to be able to bold
  • alternating lines for a huge odt document.
  • The document is too large to do
  • this manually.
  • Is there a way to do this?

1 Answers1

0

Beware that a Writer document is not a line orientated software.

How "long" a line is depends on your font, font size, page layout, screen resolution etc.

Having said that... if your document contains a text, which "lines" are separated by a paragraph break, here is a macro that would change the paragraph weight on every other paragraph.

Copy this source to a module in the "Standard" library (of your installation, or the document in question) to make it available (to all your Writer documents, or "the only one" in question) - and run it.

Sub alternating_bold
' 20150320
' tested with AOO 4.0.1, but should work with any brand/version


oDoc = ThisComponent
oText = oDoc.Text

eElements = oText.createEnumeration()

' counter
i = 0

' loop
While eElements.hasMoreElements()

   ' every element
   one = eElements.nextElement

   ' if even counted
   If ( i mod 2 = 0 )   Then 
      one.CharWeight = 200 
   End If 

   ' count it
   i = i + 1 

WEnd

End Sub

Does this help?

ngulam
  • 995
  • 1
  • 6
  • 11