PDA

View Full Version : delete character formating - how does that work???



marcelma
10-16-2010, 04:12 AM
Hello,

could someone maybe tell me where WinWord's formating philosophy is explained in detail?

What I want to do is:
Select a text and delete all character formatting, so that the selected characters have the format defined in the underlying paragraph style.

However, try what might, it doesn't work.
Even if I format the selection again with the underlying paragraph style, for example "Body Text", the selected characters will afterwards have the style "Body Text + blahblahbla" and looke definitely different from the remaining characters inside this paragraph.

Any idea?

Thank you very much in advance,
Marcel

Paul_Hossler
10-16-2010, 05:05 AM
Non-VBA -- select text and Control-Space to reset manually applied character formatting back to the style

VBA -- Selection.Font.Reset

BTW, it's Control-Q to reset paragraph manually applied formating back to the style

Paul

marcelma
10-16-2010, 07:17 AM
Hello Paul, thank you for your reply.

unfortunately <Ctrl Q> doesn't seem to do anything, while <Ctrl space> changes the whole paragraph into some other character format with as many undoable actions as there are characters in the paragraph (although I had only 3 characters selected)

Selection.Font.Reset
behaves exactly as
Selection.ClearFormatting

In this case both reset the font to 10 pt "Times New Roman", although the underlying paragraph style uses an 11 pt "Bookmark Old Style" font.
Both, the resetted passage and the surrounding characters are reported to be formatted in the Style "Body Text", though they clearly look different.

And, by the way, the "Body Text" style is based on the "Normal" style and both are defined to use the 11pt "Bookman Old Style" font. - So it can't even be that the character formatting is being reset to the "Normal" style standard.

This kind of WinWord behaviour drives me mad...

Any other idea :-)

thanks a lot in advance,
Marcel

Paul_Hossler
10-16-2010, 12:48 PM
Sorry, guess I misunderstood the question as to what you were trying to do

I take a paragraph of Normal text, select the middle part and make it bold, underlined, and italic

Select only part of that, and Control-space resets the manually applied formating back to the style, leaving the rest of that manually applied formatting as is

Paul

marcelma
10-16-2010, 01:25 PM
Hello Paul,

I tied to replicate what you have been doing - and it didn't work.
Then I shut down Word, renamed the Normal.dot template and started Word again with a virgin Normal.dot template: Lo an behold, it worked.

The "delete format" command in the style pane resets the character format to the paragraph format, if characters are selected. It resets the paragraph format to "Normal", if no characters are selected and the insertion point is within that paragraph.

<Ctrl space> workes as you described.
<Ctrl Q> doesn't seem to do anything in particular.

So it seems my template is messed up in some way. Thanks for setting me on that track. :-)

I will start a new thread now and ask how to salvage a messed up normal.dot...

greetings,
Marcel

Paul_Hossler
10-16-2010, 05:39 PM
Ctrl Q will remove any manually applied paragraph formating, Format, Paragraph, etc.

Like manually moving the left or right margins in

Paul

fumei
10-18-2010, 08:54 AM
"So it seems my template is messed up in some way. "

Yes.

This is the reason that - if possible - one should ONLY use explicit styles (and NOT any based on Normal). It makes this kind of stuff easier.

It is helpful when building up your own styles to change the "based on" from Normal to <no style> for whatever is going to be your base style.

Ctrl-Q only affects paragraph format. If SOME of the text of a paragraph is manually formatted (as this is not a paragraph format), Ctrl-Q does not do anything.