Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


If the regular-expression technique given in later replies works, that's
terrific.  If not, there is another way to make it happen by digging into 
the ODT (if that is the document you have).

MINING THE ODT

It is possible to remove all of the hard line breaks in an ODF text (Writer 
ODT) document.

The main risk is loss of all paragraphing too.  If the document is entirely 
formatted using hard line breaks, paragraphing by insertion of extra line 
breaks (blank lines) will also be lost.

It takes some surgery on the document.

 1. Use a Zip utility to open A WORKING COPY of the *.odt file.  (Rename it 
*.odt.zip is one way to make this easy.)

 2. Extract a copy of the file named content.xml.

 3. In a text editor do a search and delete (replace by nothing) of all 
"<text:line-break/>" strings in the content.xml file.  (It is helpful if you 
have a text editor that is XML friendly and doesn't show the document as if it 
is all one line of text.  But it should work anyhow so long as the text editor 
can handle a line that long [;<).

 4. Add the modified context.xml back into the Zip and close the Zip.

 5. Rename back to *.odt if needed.

 6. Open it in Writer and see if the paragraphs survived.  If not, decide how 
badly you want to go through the document and add paragraph breaks using the 
ENTER key where the breaks are needed.

ALTERNATIVES TO PLAYING IN THE ZIP

Another way, still requiring a text editor (not Writer), is to work on a
.txt file and bring the corrections back into Writer:

If (6) is really ugly, and the document is simple enough, the ODT can be saved as 
text instead.  Use a text editor to replace every consecutive *pair* of line 
endings with something absurd such as *nl*.  Then use the text editor to 
replace all remaining line endings with a single space each.  Then use the 
editor to replace each remaining *nl* (or what you used) with a line ending. 
Now bring the .txt file back into Writer and save it as an ODT real fast. 
There will still need to be cleanup.  For example, if any words were 
hyphenated between lines, those will have to be repaired.

Even if the document has images and other decorations that make this 
difficult, you might want to make a .txt version anyhow, and copy and paste 
from the cleaned up text back into the better-formatted, more-complete 
original.

Without seeing the original problem document, it is difficult to suggest 
anything that might be even simpler.

 - Dennis


-----Original Message-----
From: Pedro [mailto:pedlino@gmail.com]
Sent: Sunday, November 27, 2011 23:42
To: users@global.libreoffice.org
Subject: [libreoffice-users] Re: deleting hard returns

If your file contains plain text you can "easily" fix that with an advanced
text editor like Notepad2-mod.

However if the text is formatted it requires some LibreOffice function that
I'm not aware of but would be interested to learn :)

Anyone?

--
View this message in context: 
http://nabble.documentfoundation.org/deleting-hard-returns-tp3541244p3541556.html
Sent from the Users mailing list archive at Nabble.com.

-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? 
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.