C# wdColor

Z

Zumwalt

I am trying to set the color of the font. I have tried this a few different
ways and have yet to be able to change the color of the font. I am using C#
(mind you I have tried posting C# programming questions in the MSDN Forums
but the moderators there say C# questions for office are off topic)

Code:
WdColor setColor = WdColor.wdColorRed;
oHeader.Range.Font.Bold = 1;
oHeader.Range.Font.Size = 14;
oHeader.Range.Font.Name = "Arial";
oHeader.Range.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphCenter;
oHeader.Range.Font.Color = setColor;
oHeader.Range.InsertAfter(BlockItem.Header1.ToUpper());
 
M

MG.Karo

try to refresh your component
i never used word component but in similar cases like this u need to do
something after setting all this properties like
MyComponent. Refresh ();
or
MyComponent.Update();
Or
MyComponent.RePaint();

Something likes that.

Regards

MG.Karo
 
Z

Zumwalt

Thanks for a suggestion, however, this is not something "in" a component.
I create a word document via code, then I set text values and font values
for each "paragrph" object. When you call the insertparagraphafter, that then
'sets' the paragraph on the page (like an Enter key would if you were in word)

This is not a component on my "windows form object", otherwise what you
suggest would probably help since the component itself (like a textbox, a
label, the like) would need refreshed.

There is nothing "visible" with the word document until it is finally saved
then I run my start process method and pass it the word document I created,
in which case it launches an actual visual word document openening my
finished product.



MG.Karo said:
try to refresh your component
i never used word component but in similar cases like this u need to do
something after setting all this properties like
MyComponent. Refresh ();
or
MyComponent.Update();
Or
MyComponent.RePaint();

Something likes that.

Regards

MG.Karo




Zumwalt said:
I am trying to set the color of the font. I have tried this a few different
ways and have yet to be able to change the color of the font. I am using C#
(mind you I have tried posting C# programming questions in the MSDN Forums
but the moderators there say C# questions for office are off topic)

Code:
WdColor setColor = WdColor.wdColorRed;
oHeader.Range.Font.Bold = 1;
oHeader.Range.Font.Size = 14;
oHeader.Range.Font.Name = "Arial";
oHeader.Range.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphCenter;
oHeader.Range.Font.Color = setColor;
oHeader.Range.InsertAfter(BlockItem.Header1.ToUpper());
 

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