Table clobbers style

L

Larry Sulky

[This is a cross-post from microsoft.public.word.tables. I know this
is not clearly a VBA thing, but I suspect the answer will lie there
and I got no responses in the other group. Hoping to have better luck
here, in a more active group.]

WinWord 2003 SP3; Win 2003

I have a table in a document. I don't know what version of word was
used to create the document, bu the document is in my hands now. The
table has text styled in a handful of paragraph styles. But some of
them don't look right: style XX looks fine inside and outside the
table; style YY looks okay only outside the table -- inside, it is
centered and in Courier New.

I create two paragraphs outside the table, styled XX and YY. I copy
and paste a paragraph of style XX into the table, and all is well, as
expected -- it fits and reflows and does whatever it ought to do to
sit inside the table. I copy and paste the paragraph of style YY, and
it appears as usual in the table FOR A MOMENT, then changes to
Courier
New, centered. It's quite startling to watch it happen -- it takes
about one second. I copy that
paragraph from inside the table to a position in the document outside
of the table, and it regains its sense of style and looks as it
should.

I cannot see any significant difference between XX and YY -- yes,
they
do look a little different, but there's nothing weird going on with
their definitions that I can tell (and I work in-depth with styles
all
the bloody time).

Here's some more fun. I create another table within the document and
make it look just like the original, even copying the text from the
original table into my new one. My new table does not show the same
weird behaviour; styles XX and YY behave normally inside and out.

To sum up: the table that someone created in some version of word
"masks" the styles of some paragraph styles; the table that I created
in Word 2003 does not.

Does this sound familiar to anyone? Is there anything programmatic or
systematic I can do other
than manually rebuild each table in the incoming document?

TIA---
---larry
 
L

Larry Sulky

You may want to take a look at the article athttp://www.shaunakelly.com/word/tablestyles/index.html.

Interesting. I had run across this article before but skipped over it
because the document doesn't use table styles. But I have a suspicion
that it actually DOES use them in some hiddent way, because some of
the symptoms that Shauna describes seem similar. It at least gives me
a clue to follow -- possibly saving the file as XML and hunting for
tell-tale signs of table styles, and removing them, would work.
Thanks, Stefan.
---Larry
 
S

Stefan Blom

The problem with table styles is that you cannot get rid of them completely,
because every table has a table style (in the user interface, you can see
all of the styles applied to items at the insertion point in the old Style
dialog box).

--
Stefan Blom
Microsoft Word MVP



You may want to take a look at the article
athttp://www.shaunakelly.com/word/tablestyles/index.html.

Interesting. I had run across this article before but skipped over it
because the document doesn't use table styles. But I have a suspicion
that it actually DOES use them in some hiddent way, because some of
the symptoms that Shauna describes seem similar. It at least gives me
a clue to follow -- possibly saving the file as XML and hunting for
tell-tale signs of table styles, and removing them, would work.
Thanks, Stefan.
---Larry
 
L

Larry Sulky

The problem with table styles is that you cannot get rid of them completely,
because every table has a table style (in the user interface, you can see
all of the styles applied to items at the insertion point in the old Style
dialog box).

--


Thanks, I'll check the interface to see what's going on.

Say, do you know of a way in VBA to reveal all the four styles --
paragraph, character, table, and list -- that apply to the current
selection, or to a range? TIA
---larry
 
A

Art H

Thanks, I'll check the interface to see what's going on.

Say, do you know of a way in VBA to reveal all the four styles --
paragraph, character, table, and list -- that apply to the current
selection, or to a range? TIA
---larry

Might Character Format Reset (CTRL+Space) and/or ParagraphFormat Reset
(CTRL+Q) help?
 
S

Stefan Blom

It is relatively easy in Word 2007, which supports ListStyle,
ParagraphStyle, CharacterStyle, and TableStyle properties for range objects.

--
Stefan Blom
Microsoft Word MVP


__________________________________
The problem with table styles is that you cannot get rid of them
completely,
because every table has a table style (in the user interface, you can see
all of the styles applied to items at the insertion point in the old Style
dialog box).

--


Thanks, I'll check the interface to see what's going on.

Say, do you know of a way in VBA to reveal all the four styles --
paragraph, character, table, and list -- that apply to the current
selection, or to a range? TIA
---larry
 
S

Stefan Blom

Those commands will *clear* character and paragraph formatting not stored in
the current paragraph style.

--
Stefan Blom
Microsoft Word MVP


___________________________________________
Thanks, I'll check the interface to see what's going on.

Say, do you know of a way in VBA to reveal all the four styles --
paragraph, character, table, and list -- that apply to the current
selection, or to a range? TIA
---larry

Might Character Format Reset (CTRL+Space) and/or ParagraphFormat Reset
(CTRL+Q) help?
 
L

Larry Sulky

It is relatively easy in Word 2007, which supports ListStyle,
ParagraphStyle, CharacterStyle, and TableStyle properties for range objects.

So... nothing in Word 2003 then. Oh, well.
 
S

Stefan Blom

Well, you can use the Style property, but it is less straightforward. For
example:

Debug.Print Selection.Tables(1).Range.Style.NameLocal

prints the name of the table style applied to the selected table.

And the following commands:

Debug.Print Selection.Characters(1).Style.NameLocal
Debug.Print Selection.Paragraphs(1).Style.NameLocal

would print the name of the character style applied to the first character
in the selection and the name of the paragraph style applied to the first
paragraph in the selection.

--
Stefan Blom
Microsoft Word MVP



It is relatively easy in Word 2007, which supports ListStyle,
ParagraphStyle, CharacterStyle, and TableStyle properties for range
objects.

So... nothing in Word 2003 then. Oh, well.
 
L

Larry Sulky

Good grief! I knew that but had completely forgotten. I've used those
very commands myself in other code.

Thanks, Stefan! :)
 
L

Larry Sulky

Good grief! I knew that but had completely forgotten. I've used those
very commands myself in other code.

Thanks, Stefan! :)

Oh! I forgot to tell you all--

Table styles were indeed the problem. Once I set them to Table Normal,
all was well; the gonzo "style changes before your eyes" behaviour
stopped. We don't use table styles anyway.

Thanks again, folks.
 
S

Stefan Blom

Thank you for the follow-up.

--
Stefan Blom
Microsoft Word MVP



Good grief! I knew that but had completely forgotten. I've used those
very commands myself in other code.

Thanks, Stefan! :)

Oh! I forgot to tell you all--

Table styles were indeed the problem. Once I set them to Table Normal,
all was well; the gonzo "style changes before your eyes" behaviour
stopped. We don't use table styles anyway.

Thanks again, folks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top