Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Quite often I find myself inserting text files in OpenOffice Writer documents, then spending inordinate amounts of time reformatting the result. The problem is that those text files contain newlines, which OOWriter then uses to force a line break. Therefore, I get this:

aa bb cc dd ee
ff
gg hh ii jj kk
ll mm

when I'd rather have the whole paragraph properly formatted:

aa bb cc dd ee ff gg
hh ii jj kk ll mm

Is there a (preferably easy) way to reformat the text to achieve this result?

EDIT:

Here's a reproducible example:

123 121 21 23232 2323 232 23232 2332 23 22332 3 22 2 323 23232 23232 23 323 23232  sds sfsdfs sdfs sfsdfs
3232 232 223 23232 22323 23 23232 2323 23232 2 2 sdsd sdad asdasas adsada adasda adassda fsdfs sfsdf sfsdfs
adsaa dasa addasadaa adasads adas das adas as d a das ad a dsa da sd ad sad asasasd asds sfdfds sfsfsd
hfghfg fghfhg fhfgh fhgfh fhfgf fhghf fh fgh fg hfg hfg hfghrttyhfg  fhfh hf h f hg f hffg dfs sdfsfwet ytyt

Since there are no empty lines, I consider this text to be single paragraph. But if I insert or paste this content into a new empty document in OOWriter-3.3, I get this:

123 121 21 23232 2323 232 23232 2332 23 22332 3 22 2 323 23232 23232 23 323 23232  sds sfsdfs 
sdfs sfsdfs
3232 232 223 23232 22323 23 23232 2323 23232 2 2 sdsd sdad asdasas adsada adasda adassda fsdfs
sfsdf sfsdfs
adsaa dasa addasadaa adasads adas das adas as d a das ad a dsa da sd ad sad asasasd asds sfdfds sfsfsd
hfghfg fghfhg fhfgh fhgfh fhfgf fhghf fh fgh fg hfg hfg hfghrttyhfg  fhfh hf h f hg f hffg dfs sdfsfwet 
ytyt

Is there an automatic way to restructure the flow of text so that all lines are filled properly?

share|improve this question
    
Could you upload or link a document? It's likely that this can be captured with regex, but can't do that without understand what type of character is breaking. –  Brandon Bertelsen Apr 15 '11 at 17:31
    
The best approach might be to process the text file before inserting into OpenOffice. What operating system are you using? –  William Jackson Apr 15 '11 at 17:45
    
@William Jackson: I am using mostly Linux, so I could just sed the hell out of it, but I was hoping for a portable solution from within OO.org. –  thkala Apr 15 '11 at 17:50
add comment

1 Answer

up vote 0 down vote accepted

I found a partial solution:

  • Mark the text
  • Select Find & Replace
  • Enable regular expressions from the More Options menu
  • In Search for: enter a single $
  • Leave Replace with: empty
  • Press Replace All

This will remove all explicit newlines - not exactly what I want but very close.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.