Home > Archive > C# > October 2005 > How to create a style object and pass it via the accessor method set_style?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to create a style object and pass it via the accessor method set_style?
|
|
| rkomduur@wish.net 2005-10-11, 7:00 pm |
| Hi,
I wish to complain in the strongest possible terms about the lack of
code examples when it comes to the use of the set_style and get_style
method for Word.
The only code I have seen so far that uses set_Style uses a string to
use an internal style. The "Understanding the Word Object Model from a
..NET Developer's Perspective" lists this:
{
Because the Range.Style property expects a Variant, C# developers must
call the hidden set_Style method of the Range class in order to set the
style. Pass either the name of the style or a Style object by reference
to the set_Style method in order to apply a style to the range. In
cases in which a read/write property has been defined as a Variant in
VBA, C# developers must call the appropriate hidden accessor methods,
like set_Style and get_Style. Visual Basic .NET developers can simply
set or get the value of the property directly.
}
Then I search the entire Microsoft website and there is no single piece
of code that uses a style object! All code examples use the simple
method by passing the name of an internal style.
So, Microsoft, come on.....you invented this stuff so now give us
example code that shows how to use this stuff properly. Why give us
lots of example of the easy stuff and none about the difficult stuff.
What I want is to either create a style object myself to apply to a
table or first set the style by using the name of an internal style.
Then use get_style to get that object, change it( like the border style
or something) and then apply it to the table again.
If I use get_style to get a style object and cast it to a Word.Style
and then try to change the border style I get a runtime COM error.
PS: I also posted this in the interop list but haven't got a reply
there.
Regards,
Remco Komduur
The Netherlands
| |
| Bruce Wood 2005-10-13, 3:57 am |
| I doubt that anyone from Microsoft is monitoring this newsgroup. This
group is rather low-traffic, and doesn't get many responses from
anyone. I've never seen a Microsoft employee post responses here. Once
in a while an MVP will stop by, but not often.
I suggest that you look around http://msdn.microsoft.com. I believe
that there's a feedback section for developers there.
You might also try the "GotDotNet" developer forums. They are
maintained by Microsoft. Perhaps you can ask someone there for a code
sample.
You might also want to ask them about the upcoming changes to Word and
Excel code-behind. I've been to several seminars that outlined big
changes coming down the pipe, including being able to do direct
code-behind in .NET. I can't remember if they're part of the 2005
package, or part of a later release, though.
| |
| rkomduur@wish.net 2005-10-14, 3:57 am |
| Thanks Bruce,
I'll take a look at the mentioned websites.
|
|
|
|
|