Is there a way (even a macro will be fine) to remove all formatting from some text preserving italics and bold?
I'm editing very big documents and this problem keeps coming up... Would be great to have someway to do it, I was expecting to find something in Paste Special, but no luck with that.
Thanx
Remove Formatting... but not italics/bold.
Remove Formatting... but not italics/bold.
OOo 3.0.X on Mac OSx Leopard
Re: Remove Formatting... but not italics/bold.
AFAIK, there is no simple way to do that. You can "tag" the text you want to preserve using regular expressions, then erase the formatting and finally change the tagged text again with regular expressions.
Something like this (example is only for italics):
1) Edit -> Find / Replace -> More options -> Check regular expressions.
2) On Find, type (.*) (with parenthesis)
3) With the cursor still on the Find box, click on Format and select Italics without changing the other options.
4) On replace type <IT>$1<IT>
Now if you click Replace (first time you must do it twice), the text in italics will be surrounded by the <IT> tags. After doing a similar process for bold, you can now delete the format selecting the text and doing Ctrl+Shift+Space.
Now, to restore the italics (thanks acknak for that!):
1) Again Find & Replace with regular expressions applied
2) (<IT>)([^<]*)\1 on Find
3) With the cursor still on Find, click on No Format
4) $2 on Replace
5) With the cursor still on Replace, click on Format and select Italic without changing the other options.
Clicking the Replace button will change the tagged text into italics.
Something like this (example is only for italics):
1) Edit -> Find / Replace -> More options -> Check regular expressions.
2) On Find, type (.*) (with parenthesis)
3) With the cursor still on the Find box, click on Format and select Italics without changing the other options.
4) On replace type <IT>$1<IT>
Now if you click Replace (first time you must do it twice), the text in italics will be surrounded by the <IT> tags. After doing a similar process for bold, you can now delete the format selecting the text and doing Ctrl+Shift+Space.
Now, to restore the italics (thanks acknak for that!):
1) Again Find & Replace with regular expressions applied
2) (<IT>)([^<]*)\1 on Find
3) With the cursor still on Find, click on No Format
4) $2 on Replace
5) With the cursor still on Replace, click on Format and select Italic without changing the other options.
Clicking the Replace button will change the tagged text into italics.
There are two types of people: those who believe that there are two types of people and those who do not.
openSUSE Leap with KDE Plasma / LibreOffice
openSUSE Leap with KDE Plasma / LibreOffice
Re: Remove Formatting... but not italics/bold.
Yeah, that's what I thought.
I think all this could make a very useful macro.
I guess I'll have to start looking into macro programming then.
Thanks anyway.
Has anyone thought about macro-ing stuff like this altready? (Just in case)
I think all this could make a very useful macro.
I guess I'll have to start looking into macro programming then.
Thanks anyway.
Has anyone thought about macro-ing stuff like this altready? (Just in case)
OOo 3.0.X on Mac OSx Leopard
-
- Posts: 39
- Joined: Wed Jan 30, 2008 4:18 pm
Re: Remove Formatting... but not italics/bold.
I have the same problem, and got it solved (mostly). Check out my post Reformatting other people's documents
http://user.services.openoffice.org/en/ ... f=7&t=2172
In a nutshell, you set up a document with absolutely minimal formatting, then copy/paste the document you want changed into it.
http://user.services.openoffice.org/en/ ... f=7&t=2172
In a nutshell, you set up a document with absolutely minimal formatting, then copy/paste the document you want changed into it.
OO 3.2.0 on Linux Mint 9 KDE
-
- Posts: 5
- Joined: Wed Oct 08, 2008 2:08 pm
Re: Remove Formatting... but not italics/bold.
did anyone write a macro in the meantime?
anyway, the trick I found here worked for me...
http://www.oooforum.org/forum/viewtopic.phtml?t=83738
changing all italics and bolds to some language not included in the text (eg, all italics to armenian, all bold to albanian), default all text, and then select all armenian and direct format to italics (and to your original language), select all albanian and direct format to bold (and to your original language).
so this did the trick for me, but if somebody's into writing macro, that would be great
anyway, the trick I found here worked for me...
http://www.oooforum.org/forum/viewtopic.phtml?t=83738
changing all italics and bolds to some language not included in the text (eg, all italics to armenian, all bold to albanian), default all text, and then select all armenian and direct format to italics (and to your original language), select all albanian and direct format to bold (and to your original language).
so this did the trick for me, but if somebody's into writing macro, that would be great
Libreoffice on Ubuntu 11.x