Change the format in writer

Hi,

I have a .txt that non fill the whole line in each line, how can i transform this when i copy and paste to writter . For example i have the following:

“i want to go to spain tomorrow
but i have not enought money”

I want the following in writter:

“i want to go to spain tomorrow but i have not enought money”

of course my text is very long.

thanks in advance

Can this comment help? word wrap does not work properly - #5 by EarnestAl

I understand that your .txt file is already made of “lines”, i.e. some text terminated by an explicit line break (encoding depending on OS, but usually a single control char like U+000A LINE FEED or a pair U+000D CARRIAGE RETURN and U+000A).

When you paste into Writer, the line break is transformed into a paragraph break and you end up with lots of single line paragraphs.

This can be fixed provided either your plain text file has some structure or you modify it to impose this structure. By structuring the file (in your usual text editor), I mean you terminate paragraphs by a unique signature before the last line break, e.g. something like <*#*>, making sure it never happens in your text.

When this is done, use you text editor find-and-replace function to remove all line breaks. Then replace all signatures by a line break.

Warning! Some editors won’t accept too long lines (my procedure outlined above will create a file consisting of a single very long line). A work around is to use an alternate strategy based on regular expressions if you know how to use them. There, no need for a signature. Terminate all paragraphs with a double line break (including the last one at end of file). Replace line break by nothing only if it is not a double line break. Make a last pass to replace double line breaks by a single line break.

Macro generators can simplify the procedure by doing everything in a single pass. But you still have to mark manually the paragraphs with a double line break.

thanks for your answer, but how i know the end of line of my txt? I work in debian with kwrite (.txt editor)

When it’s a genuine plain ASCII text, open it with Writer. Now select Tools | AutoCorrect | AutoCorrect Options, select the Options tab and tick the item at the bottom, Combine single length paragraphs if length greater than 50%. Next select AutoCorrect | Apply. That will auto format your text and combine lines that really are a single paragraph. In some cases, the last line of a paragraph can be almost as long as a line, in such cases the procedure will combine two paragraphs, so you will have to check the result.

If, when enlarging KWrite window, line distribution of your text doesn’t change, your lines are effectively terminated by an explicit line break. In regular expressions, this end of line is designated by \n.

The trick explained by @anon87010807 may give immediate results with less fuss. I’ve personally never tried it because I prepare my plain text insertions before hand.

Rather than just pasting into Writer, try Edit>Paste Special>Paste Unformatted Text.

Try Join broken lines/paragraphs… of OOoFBTools.