Styles and regular expression in libreoffice

Hi all

I'm on libreoffice 3.6 italian version
I'm working on many ebook in epub format.
Fortunately libreoffice has a great extension, writer2epub, who's wonderful

My problem is that original files (word exported by indesign) are a mess with styles, fonts, etc
Really a chaos.

I need some way to get some works on styles via reg ex but I've found nothing, nor in the help, nor in the wiki, nor of useful on internet

My first need is to modify lines before and after the chapter title.
In my doc I've a blank line, a line with the chapter title and one or more blank lines all in header1 style

I haven't found a way to select styles via regex and I can't simply change all the blank lines because they are in many different styles

I've already searched on internet and in the libreoffice/openoffice forum but I haven't find any solutions.

Can you help me?

Thanks

This may not be much help, but when I have been faced with a converted file that was such a formatting mess, I would just save it as a plain text file and format from scratch, creating and applying the specific Styles I wanted. There are drawbacks to this, as you will lose some of your content, such as footnotes.

Good luck.

Virgil

When I do this, nothing is lost except the formatting ...
             merely 'select all' -> copy -> paste to notepad -> all the
text will be there; just re-format everything and place back in line :wink:

This may not be much help, but when I have been faced with a converted file

Hi all

Thanks for your suggestion but it isn't a way I can walk.
I have documents of more than 500 pages, if I must reformat all I never end

I can't remove all formatting and start from scratch because it take too many time.
I can't remove all blank paragraphs because many of them are useful.
I can't use regex for automatize the work.
It's really a sin.

So well, I must work on Office Word first for formatting document and then convert it.
I would want to work totally on libreoffice but it isn't possible evidently.

Thanks to all

Hi :) 
Styles and Templates are a really fast way of imposing new formatting after you have converted it all into plain text.  It might sound like something that is going to take ages but you would be surprised at how fast you can get through it the way people are recommending.  It surprised me!

With Word i had often spent hours trying to un-mess documents from other people but Writer's use of styles makes it fast and simple.

Another advantage with Writer's use of styles is that you can change the font throughout a document really quickly.  Just right-click on the "text body" style and change the font there.  Same with the "default" style and then as you go through other styles you have used you may find some have already changed automatically.

I sometimes select a large area of text and force it to change style between a few different styles that i don't want the text to appear in and then settle it all as "text-body".  That usually clears a lot of the messes.  Then just go through and select headings and sub-headings and set their style as "heading1" or "heading 2" or whatever is the appropriate level.

See Chapter 3 in the Getting Started Guide as it probably has even faster ways of getting through the document
https://wiki.documentfoundation.org/Documentation/Publications

Good luck and regards from
Tom :slight_smile:

Maybe I'm not understanding your problem, but ...
           it should take less time to 'select all' -> paste into notepad
[thereby removing all formatting]
                -> 'select all' and paste into a new LO blank document.
       At this point, 'select all' and click on the formatting you desire;
          then scan through to catch the footnotes to place them back in
line.

       I've done this a few times; time is about 15 minutes; having to scan
through those footnotes which have become out of line :wink:
          save time at this point by 'find'ing each by number :wink:

Hi all

thanks; some more good tips.

Hi :slight_smile:

You've said this a couple of times now, so it is worth pointing out (perhaps for other readers' benefit) that this is an unnecessarily complicated technique. Use of Edit | Paste Special... | Unformatted text (or Ctrl+Shift+V | Unformatted text) in LibreOffice is all that is required. No need for Notepad or any other separate software.

Brian Barker

The KeepItSimpleS method is the way I've always found most effective;
            saves having to memorize all those short-cuts - acronyms - ...
... ...

You think it is "simpler" to start a separate piece of software, copy and paste some text out of one program into the other, and copy and paste it back again, than just copy-and-pasting it back over itself in the original document? Pardon me, but Ho, ho!

You are very welcome to do this, of course. (I was evidently more right than I knew when I added "perhaps for other readers' benefit"!)

Brian Barker

If you merely copy & paste over the initial file, then the messed-up
formatting may still exist;
            in order to be sure of eliminating whatever might be causing
the 'kink', the document needs to be fresh :wink:

       I learned this when that silly .rtf was around ... I had a great
letter ready to print out then mail off;
            I printed the first one to re-edit for any typos I might have
missed to discover that intermingled among the text was all this
gobbledegook :wink:
       After trying 3 times, I switched to notepad; this cleared the
formatting ... then I placed the text around the images in OO [yes, it was
a while back :wink: ]
           and it printed out as it appeared on the monitor :slight_smile:

If you merely copy & paste over the initial file, then the messed-up formatting may still exist;

That's why that wasn't my suggestion!

in order to be sure of eliminating whatever might be causing the 'kink', the document needs to be fresh :wink:

That's not true. But in any case, you are presumably suggesting that a fresh document would anyway be necessary with your round-the-houses route via other software.

Again, you are very welcome to go the long way around if you prefer. You will not be the only person to do so.

Brian Barker

I had never heard of the "paste special" feature, so I just tried it. I started with an .rtf file that LO didn't like. I selected the entire file with Ctrl-A, copied it (Ctrl-C) and then pasted it special back onto itself as "unformatted text." It worked just as well as copying to a text editor. Kinda slick actually.

But, with either method, I lost the contents of my footnotes. To date, I haven't found a way with LO to convert formatted text to plain unformatted text and keep footnotes.

Virgil

libreoffice

If you merely copy & paste over the initial file, then the messed-up formatting may still exist;

That's why that wasn't my suggestion!

in order to be sure of eliminating whatever might be causing the 'kink', the document needs to be fresh :wink:

That's not true. But in any case, you are presumably suggesting that
a fresh document would anyway be necessary with your round-the-houses
route via other software.

Again, you are very welcome to go the long way around if you
prefer. You will not be the only person to do so.

Brian Barker

The problem is not with Paste Special... but simply with the fact that Ctrl+A selects either all the body text or all of a single footnote, depending on where the cursor is. If you paste an unformatted copy of the body text, you lose the connection to footnotes and so lose the footnotes too.

But there is a way to salvage the footnote text:
o Go to Edit | Find & Replace... (or Ctrl+F).
o If necessary, click More Options.
o Tick "Search for Styles".
o Under "Search for", select Footnote from the drop-down menu.
o Click Find All to select the text of all footnotes.
o You can now copy the footnote text and paste it as required.

The text of all the footnotes will be concatenated into a single piece of text and will lose all connection to the original footnote markers - but this is in the nature of what you will be trying to achieve using Paste Special... in any case, of course.

I trust this helps.

Brian Barker

yes, footnotes become jumbled;
           but the fact these are numbered makes them 'find'able :wink:

       During the 15-30 minutes you're locating these and correcting them,
           you can contemplate all sorts of nasty things to do to these
'glorified typewriters'
             or
          you can think pleasant thoughts while listening to some nice music
            or
           ... somewhere in between :wink:

I had never heard of the "paste special" feature, so I just tried it. I

I think you are making this up! If you copy the footnote text and paste it (even if you don't use Paste Special...), you get just the text of the footnotes: there are no numbers. And strictly, the text of the different footnotes is concatenated, not jumbled, of course. But perhaps you mean the footnote markers in the body text; they are indeed preserved (though no longer connected to anything).

Brian Barker

This message [below] is not as I sent it -
            I do not know how the bracketed information appeared in the
middle of my message -
                 I don't even know what [if you use Paste Special... to
paste unformatted text] means :wink:

       But: footnotes are numbered - therefore, clicking on 'find' and
'search'ing the number will locate the footnote ...
            continuing in this fashion, from 1 until each has been found
and re-formatted, is not that time-consuming - more frustrating having to
re-do what was already done before whatever 'kink' interfered :wink: