Hi there.
Could somebody please help me with the filling in of Find and Replace (Ctrl+H) so that all Line Spacing 1.5 Lines will be replace with Below Paragraph 0.25.
Many thanks for your help.
Hi there.
Could somebody please help me with the filling in of Find and Replace (Ctrl+H) so that all Line Spacing 1.5 Lines will be replace with Below Paragraph 0.25.
Many thanks for your help.
Your best approach is to learn styles and to replace all direct formatting with an appropriate style (paragraph, character and page for a start).
I agree. What would be the best way to learn Styles? Are you aware of tutorials, preferably in video format?
Start with the chapters about styles in the Writer Guide.
If you already have some experience with sophisticated document processor, built-in help (F1
) can be a valuable concise feature description and procedure (too concise for newbies in Writer).
Be cautious about public video tutorials: many of them mix styling and direct formatting. This is even worse than pure direct formatting.
Thank you.
1.5 line spacing is not something in the text. It should be in the syle of the paragraph.
Put your cursor in the paragraph, and open the side-bar to the right.
Check wich style is active for the paragraph and modify according to your needs.
If the same style is used for all the text, the whole document will be changed.
Thanks. But no style applied.
You can use the Basic macro, but it is only for the normal paragraphs, not for the paragraphs in the tables, frames etc.
Sub ReplaceParaLineSpacing 'only for normal paragraphs; not for tables, frames etc.
on local error resume next
dim oDoc as object, oEnum as object, o as object, oLineSpacing as new com.sun.star.style.LineSpacing
with oLineSpacing 'for Single line spacing
.Mode=0
.Height=100
end with
oDoc=ThisComponent 'actual document
oEnum=oDoc.Text.createEnumeration()
do while oEnum.hasMoreElements() 'enumerate the paragraphs
o=oEnum.nextElement()
if o.supportsService("com.sun.star.text.Paragraph") then 'text paragraph
if o.ParaLineSpacing.Mode=0 AND o.ParaLineSpacing.Height=150 then 'Line Spacing is 1.5
o.ParaLineSpacing=oLineSpacing 'set normal Line Spacing
o.ParaBottomMargin=200 'set Bottom Margin 0,2 cm
end if
end if
loop
End Sub
Sorry I’m not familiar with macros but this topic is on my list of things to learn whenever I have greater need for macros and have “some” spare time. Nevertheless, thank you for your answer.
for each
works not only on containers with index-access also for enumeration-access:
Sub ReplaceParaLineSpacing 'only for normal paragraphs; not for tables, frames etc.
on local error resume next
dim LineSpacing as new com.sun.star.style.LineSpacing
with LineSpacing 'for Single line spacing
.Mode=0
.Height=100
end with
doc=ThisComponent 'actual document
for each para in doc.Text
if para.supportsService("com.sun.star.text.Paragraph") then 'text paragraph
if para.ParaLineSpacing.Mode=0 AND para.ParaLineSpacing.Height=150 then 'Line Spacing is 1.5
para.ParaLineSpacing = LineSpacing 'set normal Line Spacing
para.ParaBottomMargin=200 'set Bottom Margin 0,2 cm
end if
end if
next para
End Sub
While I agree with @ajlittoz, you want a fix for your current document.
Warning: first read the following, take any precautions necessary, like save a back-up copy in case anything goes wrong, only then make the changes as described.
Ctrl+H
) open, tick Format, select the Indents & Spacing
tab, select the appropriate line spacing that you want to replace, OK to confirm and close the Format dialog box.Ctrl+M
to remove direct formatting (the line spacing, but also anything else). If you do that carefully, the found paragraphs will still be selected after that. Warning: first save any text with special formatting, like italics. You can find all text in italics in exactly the same way as text with 1.5 line spacing. Apply a character style to the selection (works across the entire document).There is nothing wrong with direct formatting if you work on short documents or if your formatting is simple and doesn’t have to be consistent. As soon as you have lots of headings or other text elements with special formatting - like quotations, text with borders -, want an automatically generated ToC etc, styles will make your life much easier.
Thank you. It worked but it changed also tab stops and font size. Tab stop correction is no problem as I can include them when inserting the correct spacing but there’s no option for changing font size.
Font size, tab stops, etc., should also be controlled by (paragraph) styles. This kind of problems that you have now run into is exactly why styles were invented. So you have a document with different formatting for different text types, and all you have to do when you want to change the formatting is to modify the styles.