CreateInstance - set font properties for excel

  • Thread starter Thread starter News.microsoft.com.DotNet
  • Start date Start date
N

News.microsoft.com.DotNet

Hi,

Hope someone can help me out with this. I have a CC3 sharp app that needs to
export data to an excel file. Problem is the version of excel can be 97 to
2003.

Anyway, have been able to use InvokeMember for ranges and values, ie:

Parameters = new Object[2];

Parameters[0] = "C2:C6";

Parameters[1] = Missing.Value;

objRange_Late = objSheet_Late.GetType().InvokeMember(
"Range",BindingFlags.GetProperty, null, objSheet_Late, Parameters );

Parameters = new Object[1];

Parameters[0] = "=A2 & \" \" & B2";;

objRange_Late.GetType().InvokeMember( "Value",
BindingFlags.SetProperty,null, objRange_Late, Parameters );

What I can't figure how to is set properties like the font, font.color,
bold, etc.

I have looked, searched everywhere I can think of.

I sure would appreciate any help and guidance.



Thanks in advance,



Bud Dean
 
Maybe this works.

object oFont = Rng.GetType().InvokeMember("Font",
BindingFlags.GetProperty, null, Rng, null);
oFont.GetType().InvokeMember("ColorIndex", BindingFlags.SetProperty, null,
oFont, new object[]{5});
oFont.GetType().InvokeMember("Bold", BindingFlags.SetProperty, null,
oFont, new object[]{true});
 

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

Back
Top