How to set Word color in c#? The only colors that I am able to set in Word
are in enumeration WdColor.
Word.WdColor color = Word.WdColor.wdColorTurquoise;

How can I set in c# shadings that are not in enumeration, for example
â??Blue, Accent 1â???


Thank you.

RE: How to set Word colors in c#? by JeanGuyMarcil

JeanGuyMarcil
Tue Jun 17 11:42:00 PDT 2008

"Word user 2007" wrote:

> How to set Word color in c#? The only colors that I am able to set in Word
> are in enumeration WdColor.
> Word.WdColor color = Word.WdColor.wdColorTurquoise;
>
> How can I set in c# shadings that are not in enumeration, for example
> â??Blue, Accent 1â???

In VBA, you can use:

Selection.Range.Font.Color = RGB(10, 60, 165)


RE: How to set Word colors in c#? by Worduser2007

Worduser2007
Tue Jun 17 12:28:03 PDT 2008



"Jean-Guy Marcil" wrote:

> "Word user 2007" wrote:
>
> > How to set Word color in c#? The only colors that I am able to set in Word
> > are in enumeration WdColor.
> > Word.WdColor color = Word.WdColor.wdColorTurquoise;
> >


Is there any way to do it in C#?
> > How can I set in c# shadings that are not in enumeration, for example
> > â??Blue, Accent 1â???
>
> In VBA, you can use:
>
> Selection.Range.Font.Color = RGB(10, 60, 165)
>



RE: How to set Word colors in c#? by JeanGuyMarcil

JeanGuyMarcil
Tue Jun 17 12:54:01 PDT 2008

"Word user 2007" wrote:

>
> Is there any way to do it in C#?
> > > How can I set in c# shadings that are not in enumeration, for example
> > > â??Blue, Accent 1â???
> >
> > In VBA, you can use:
> >
> > Selection.Range.Font.Color = RGB(10, 60, 165)
> >

I believe RGB is a VB function.

I do not know if there is an equivalent in C#.
This is a VBA group after all...

Try in:
microsoft.public.dotnet.languages.csharp

Re: How to set Word colors in c#? by Tony

Tony
Tue Jun 17 15:44:40 PDT 2008

The 2007 Theme Colors are not RGB values. The whole thing is described here:
http://www.wordarticles.com/Articles/Colours/2007.htm (well, maybe not the
whole thing yet, but it should be enough) - it gives VBA code but you can
use the same hex values in any language.

--
Enjoy,
Tony

"Jean-Guy Marcil" <JeanGuyMarcil@discussions.microsoft.com> wrote in message
news:2B878F08-9314-43FB-BB58-2C2AD1CED8A2@microsoft.com...
> "Word user 2007" wrote:
>
>>
>> Is there any way to do it in C#?
>> > > How can I set in c# shadings that are not in enumeration, for
>> > > example
>> > > â??Blue, Accent 1â???
>> >
>> > In VBA, you can use:
>> >
>> > Selection.Range.Font.Color = RGB(10, 60, 165)
>> >
>
> I believe RGB is a VB function.
>
> I do not know if there is an equivalent in C#.
> This is a VBA group after all...
>
> Try in:
> microsoft.public.dotnet.languages.csharp


Re: How to set Word colors in c#? by Cindy

Cindy
Wed Jun 18 06:18:03 PDT 2008

> How to set Word color in c#? The only colors that I am able to set in Word
> are in enumeration WdColor.
> Word.WdColor color = Word.WdColor.wdColorTurquoise;
>
> How can I set in c# shadings that are not in enumeration, for example
> â??Blue, Accent 1â???
>
I copied the following from the VSTO forum some time ago:

"You can't directly convert a System.Drawing.Color value to its WdColor
equivalent.  The Font.Color property can be set to a WdColor value or the
result of the VB RGB function.  The Microsoft.VisualBasic.Information.RGB()
method duplicates this function.  So you can do the following:

Code Snippet
rng.Font.Color = (Microsoft.Office.Interop.Word.WdColor)
Microsoft.VisualBasic.Information.RGB(0, 112, 192);


Note that this requires you reference the Microsoft.VisualBasic assembly from
your project.

You can also use the System.Drawing.ColorTranslator.ToOle() method.  This
doesn't require the reference to the Microsoft.VisualBasic assembly."

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)


Re: How to set Word colors in c#? by JeanGuyMarcil

JeanGuyMarcil
Wed Jun 18 09:37:00 PDT 2008

"Tony Jollans" wrote:

> The 2007 Theme Colors are not RGB values. The whole thing is described here:
> http://www.wordarticles.com/Articles/Colours/2007.htm (well, maybe not the
> whole thing yet, but it should be enough) - it gives VBA code but you can
> use the same hex values in any language.
>

Ha! I just noticed the "2007" in the poster alias...
I had just focused on the subject line...
I don't have 2007 on my machine at work and I am not all that good with
C#... Should've stayed away!

Thanks for jumping in!