Page 1 of 1
Remove direct formatting but retain character styles
Posted: Mon Jan 07, 2008 5:08 pm
by huw
How do I remove all direct formatting but retain all applied styles, including character styles and list styles.
I just needed to tidy a document containing both direct and styled formatting. I was unable to remove direct paragraph or character formatting without losing applied character styles, and list styles left me hopelessly confused. Was I doing something wrong (select, right-click, default), or is this just the way things are?
I use mainly Calc and don't have much experience with styles beyond Calc's cell & page styles.
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 07, 2008 5:22 pm
by foxcole
huw wrote:How do I remove all direct formatting but retain all applied styles, including character styles and list styles.
Direct formatting and character styles exist at the same level in the code, so removing the direct formatting---that is, applying the default paragraph formatting---will also remove character styles because they're not part of the default paragraph format. I don't like that either, but I don't see a way around it.
What exactly do you mean by having problems with list styles? If they truly are list styles, you won't lose anything by applying default paragraph formatting to them. Could you please be more specific, or maybe post a sample file?
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 07, 2008 7:00 pm
by huw
foxcole wrote:Direct formatting and character styles exist at the same level in the code, so removing the direct formatting---that is, applying the default paragraph formatting---will also remove character styles because they're not part of the default paragraph format. I don't like that either, but I don't see a way around it.
Thanks. That's what I feared.
foxcole wrote:What exactly do you mean by having problems with list styles? If they truly are list styles, you won't lose anything by applying default paragraph formatting to them. Could you please be more specific, or maybe post a sample file?
It was a bulletted list, one item of which had a numbered sub-list of its own. When I selected the lot and set it to default, none of the bullets or the sub-list numbering disappeared, even though none of the list styles highlighted in the styles pane when the cursor was in a list item. The sub-list did lose its indent for item number 1 (the only sub-list item to have retained its indent). The content was pasted with formatting into a blank Writer doc from an email application.
I have attached an anonymised version. I can't tell whether the lists are using hidden styles, or if they have direct formatting that doesn't get removed with the usual method. But as I say, I am new to this.
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 07, 2008 7:50 pm
by foxcole
huw wrote:I can't tell whether the lists are using hidden styles, or if they have direct formatting that doesn't get removed with the usual method. But as I say, I am new to this.
I think this might be the case, since it's pasted in from e-mail. The paragraph style of those bulleted items appears to be Text Body. If I open the file with 7-Zip, I see the Text Body style definition includes a bullet... even though nothing shows up on the Numbering tab in that Text Body style, and even though the Bullet tool in the toolbar is not highlighted as I would expect for direct formatting. It seems to be treating the bullet as part of the paragraph's default style.
But if you click in one of those paragraphs and click the Bullet tool, the bullets go away.
Re: Remove direct formatting but retain character styles
Posted: Tue Jan 08, 2008 11:06 am
by huw
Writer knows they're a list because the Bullets & Numbering toolbar appears when the cursor is in it, but creating new text using the Text Body style does not result in bullets appearing, so they're neither a simple bullet character at the beginning of a paragraph with a hanging indent, nor a style, they are direct formatting which can't be removed using the Default Formatting option.
In fact, this is what is created in a new blank document using the list button on the Formatting toolbar (I just tried it). No wonder it's so hard to convert people to styles! Writer has a reputation as one of the better word processors to use them, and it
still requires obscure knowledge like this to create a purely styled document with no direct formatting.
Most of us know how difficult it is to work on a document using styles until all direct formatting has been removed, but my ideal approach is to apply styles over the top and then set the doc to Default, revealing the styles beneath. Which is obviously not practical in all situations, including this one, beacause
- Character styles are removed along with direct formatting when Default is applied, and
- Some direct formatting is not removed by applying Default
The alternative of pasting out and back in again via a plain text editor is not only inelegant, it also necessitates lots of window swapping to compare documents as you recreate the direct formatting using styles.
Thanks for your help. I'll go back to my spreadsheet now...
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 28, 2008 11:42 am
by huw
I just came across
issue 85464: Choosing 'Default formatting' does not remove character styles, which implies that although poorly specified / documented, it
is intended behaviour for 'Default Formatting' to remove character styles.
It's a shame there's no simple way to remove all direct formatting, but retain
all applied styles.
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 28, 2008 5:06 pm
by acknak
I read i85464 to mean that the intended behavior was that Format > Default would
not remove applied styles, only direct formatting. The latest snapshots behave this way: Format > Default no longer removes applied characters styles.
I added a comment/question to
Issue 47893:
Format --> Default resets applied character style., but have gotten no response.
Are these two issues duplicates? Looks like it to me.
Sorry, I'm probably butting in and confusing the issue--again

Re: Remove direct formatting but retain character styles
Posted: Mon Jan 28, 2008 6:22 pm
by huw
Not confusing, but definitely reading it differently to me. I still read 85464 as saying failure to remove character styles was a regeression, and that it has been fixed. I'd expect it to appear in the latest build soon.
Anyway, I've had my say at 47893 too.
Re: Remove direct formatting but retain character styles
Posted: Mon Jan 28, 2008 6:58 pm
by acknak
... definitely reading it differently to me.
You are too kind. After some more coffee and a second reading, I think you are exactly right: issue 85464 is intended to make Format > Default remove character styles again.
Re: Remove direct formatting but retain character styles
Posted: Wed Jan 30, 2008 4:35 am
by foxcole
When you think about it, that's the way it should be, isn't it? To return a paragraph to its default style means to remove everything that's not the paragraph's default style.
It is unfortunate that you can't tag character styles when you apply them, so they'll be protected when default formatting is applied, but all told, I'd rather know what to expect when I ask for the default paragraph style and not have to guess what will or won't be removed. I realize this can be awkward for people who use character styles to apply different languages within a paragraph, but there doesn't seem to be a one-size-fits-all solution for this, yet, so I'd rather err on the side of predictability.
Re: Remove direct formatting but retain character styles
Posted: Wed Jan 30, 2008 10:54 am
by huw
Surely it is a better compromise to have to use two steps to remove all styles (i.e. apply default character style, then apply default paragraph style), than it is to be able to do that in one step (with Default), but have no way of removing direct formatting alone!