Ask Your Question
0

Formatting nightmare - macros

asked 2021-01-07 17:42:29 +0200

Backintimeplease gravatar image

updated 2021-01-08 07:09:15 +0200

image description

Hi does anyone know please how to format the text (in the image) to all be on one line, with a macros or find and replace (Just between the numbers),

there are no spaces I tried removing multiple spaces with find and replace, thinking that would fix it

:) :)

I know it's not exactly easy but there maybe someone out there bored and could figure it out, you never know...

Before every number there is a shift Rtn line break, I don't think they are in between the numbers.

It is a Bible, its just a personal project

Thanks for reading this...

C:\fakepath\Untitled 132.odt

edit retag flag offensive close merge delete

Comments

1

Why don't you upload that snippet as a file, so someone could examine properly and provide a tested solution? (Text as Image can't be reformatted by means of LibreOffice Writer)

Opaque gravatar imageOpaque ( 2021-01-07 17:49:14 +0200 )edit

Using Shift+Enter is faulty because you end up with a single paragraph throughout. To be able to correctly format a book, you need separate paragraphs (Enter) otherwise you're in a real desperate nightmare.

Edit your question to describe the source document: already type in some document processor? Plain text? Have you already manually forced the line breaks?

Don't forget your OS and LO version.

ajlittoz gravatar imageajlittoz ( 2021-01-07 19:10:02 +0200 )edit

Hi Ajlittoz , thanks,

I could be wrong about that, I came to the conclusion it must be what happened. No I didn't force the breaks.

Whatever the breaks are they were part of the original file, which wasn't made by me.

The file came, all in one font, and all in one font size, it may have been a .txt file I can't find the original file now, its buried somewhere

LO 7.0

and

OS Win 7

Backintimeplease gravatar imageBackintimeplease ( 2021-01-07 20:26:10 +0200 )edit

Don't use sections when there is no reason: if your document is to be completely 2-column, change the page style for 2-column. This is safer and more reliable.

ajlittoz gravatar imageajlittoz ( 2021-01-08 08:03:40 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2021-01-07 23:52:52 +0200

Opaque gravatar image

updated 2021-01-08 12:58:11 +0200

Hello @Backintimeplease

The following Edit -> Find and Replace series of four actions works for me (all require option [x] Regular expressions being enabled in Other options and of course are finalized by clicking button Replace All)

1) Remove all paragraphs

Find: $
Replace: leave empty

2) Enter paragraph in front of Psalm nn

Find: (Psalm\s+\d+\s)
Replace: \n$1

3) Replace all multiple space characters

Find: \s+
Replace: "" (don't use the quotes, just to show the single space character; just type a space here)

4) Insert a paragraph in front of each number, but not if number is preceeded by Psalm

Find: (\d+(?<!Psalm.{1,3}))
Replace: \n$1

Here is the resulting file: C:fakepathVers132-Modified.odt

Note(s)

  • Always perform on a copy of the original file
  • Enable option View -> Formatting Marks (CTRL+F10)

Tested using LibreOffice

Version: 7.0.4.2,Build ID: dcf040e67528d9187c66b2379df5ea4407429775
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5
Locale: en-US (en_US.UTF-8); UI: en-US,Calc: threaded


Hope that helps.

If the answer works for you, please consider to click the check mark (✔) next to the answer. Thanks in advance ...

edit flag offensive delete link more
0

answered 2021-01-08 00:01:29 +0200

LeroyG gravatar image

updated 2021-01-08 00:06:02 +0200

Not a macro.

  • Mark the end of each chapter number:

    1. Press Ctrl+H to open the Find & Replace dialog
    2. In the Find: field type [0-9]$
    3. In the Replace: field type (use another symbol if is already in the document)
    4. Check Regular expressions
    5. Click Replace All
  • Mark the start of each verse:

    1. Press Ctrl+H to open the Find & Replace dialog (skip this step if already open)
    2. In the Find: field type ^ [0-9]
    3. In the Replace: field type ¶&
    4. Check Regular expressions (skip this step if already checked)
    5. Click Replace All
  • Select only Regular (no bold) text:

    1. Press Ctrl+H to open the Find & Replace dialog (skip this step if already open)
    2. In the Find: field type .+
    3. Click Format, choose Font tab, and select Style Regular, OK
    4. Check Regular expressions (skip this step if already checked)
    5. Click Find All
  • Replace all end of paragraphs in the selected text:

    1. Press Ctrl+H to open the Find & Replace dialog (skip this step if already open)
    2. In the Find: field type $ and click the No Format button
    3. In the Replace: field type (a space)
    4. Check Current selection only
    5. Check Regular expressions (skip this step if already checked)
    6. Click Replace All
  • Replace all symbols by a start of paragraph:

    1. Press Ctrl+H to open the Find & Replace dialog (skip this step if already open)
    2. In the Find: field type
    3. In the Replace: field type \n
    4. Uncheck Current selection only
    5. Check Regular expressions (skip this step if already checked)
    6. Click Replace All
  • Add a start of paragraph before each "Psalm":

    1. Press Ctrl+H to open the Find & Replace dialog (skip this step if already open)
    2. In the Find: field type P
    3. Click Format, choose Font tab, and select Style Bold, OK
    4. In the Replace: field type \nP
    5. Check Regular expressions (skip this step if already checked)
    6. Click Replace All

You can delete extra spaces at end of paragraphs (+$), change spacing above paragraph, and so on.

Tested with LibreOffice 6.4.7.2 (x64); OS: Windows 10.0.


Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

edit flag offensive delete link more

Comments

LeroyG, thank you Sir, you are a chief among men, your info will help others too

Opaque, thank you... this fix works perfectly you are a genius,

I laugh at how awesome people are... tried to do this and got nowhere,

If I had money I’d pay you LeroyG and Opaque, but sadly I do not, hence why I’m here and not paying somewhere… slave labour it has to be :) - it will help others too

Backintimeplease gravatar imageBackintimeplease ( 2021-01-08 12:10:26 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-01-07 17:42:29 +0200

Seen: 70 times

Last updated: Jan 08