S
seabird
I am creating a word document from a source accessed by a Ruby program. It
mostly works, but occasionally Word gets the style wrong.
This is most commonn with some of the heading styles. Fior example, my
Heading 3 style is defined to use "Body Text" as the "Style for Following
Paragraphs:"
In my code, I explicitly set the style for each block of text I send. The
attached snippet shows that happening:
def s(style,text)
@wordDoc.Range.Style = style
@wordDoc.TypeText(text << "\n")
@wordDoc.Range.Style = "Body Text"
end
Every once in a while, Word refuses to acknowledge the style that I am
passing into the s() method. Instead it uses the style that is the "following
paragraph" style from the previous text block.
I would be tenmpted to believe that this was a pure programming error on my
part, however I have some evidence that it may not be.
It happens inconsistently. The same loop is executed with different values
and Word chooses to just get a few of them wrong. So in a 1000 page document
(don't ask!), about 10 of the blocks will exhibit this behavior.
I have also noticed that this situation can occur when I am typing by hand
and set up something to use a specific style. Word will sometimes (not
consistently) get the following style wrong and give me something quite
unexpected.
Any ideas gratefully received.
Thanks
Chris
mostly works, but occasionally Word gets the style wrong.
This is most commonn with some of the heading styles. Fior example, my
Heading 3 style is defined to use "Body Text" as the "Style for Following
Paragraphs:"
In my code, I explicitly set the style for each block of text I send. The
attached snippet shows that happening:
def s(style,text)
@wordDoc.Range.Style = style
@wordDoc.TypeText(text << "\n")
@wordDoc.Range.Style = "Body Text"
end
Every once in a while, Word refuses to acknowledge the style that I am
passing into the s() method. Instead it uses the style that is the "following
paragraph" style from the previous text block.
I would be tenmpted to believe that this was a pure programming error on my
part, however I have some evidence that it may not be.
It happens inconsistently. The same loop is executed with different values
and Word chooses to just get a few of them wrong. So in a 1000 page document
(don't ask!), about 10 of the blocks will exhibit this behavior.
I have also noticed that this situation can occur when I am typing by hand
and set up something to use a specific style. Word will sometimes (not
consistently) get the following style wrong and give me something quite
unexpected.
Any ideas gratefully received.
Thanks
Chris