Hullo Good Guys,
I am using C#NET2008 and EXCEL 2003.
I am trying to set a specific ROW FONT COLOR to COLOR.BLUE on the Spreadsheet.
I have tried 2 different ways after initial error message and both ways are not working.
I do encounter error messages.
-----------------------------------------------------------
Error message:
No overload for method 'this' takes '1' arguments
Coding:
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;
Error message:
'object' does not contain a definition for 'Style' and no extension method 'Style' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Coding:
xlWrksheet.Rows[intRow].Style.Font.Col or = Color.Blue;
-----------------------------------------------------------
//declare Excel object
Excel.Applicati on xlExcel = null;
Excel.Workbook xlWrkBook;
Excel.Worksheet xlWrksheet;
object oMissing = System.Reflecti on.Missing.Valu e;
public void FMethodOpenExce l
{
// declare instantiate Excel Object
xlExcel = new Excel.Applicati on();
xlWrkBook = xlExcel.Workboo ks.Add(oMissing );
xlWrksheet = (Excel.Workshee t)xlWrkBook.Wor ksheets.get_Ite m(1);
//load Excel and define object
xlExcel.Visible = true;
int intRow = 6;
int intCol = 0;
example #1
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;<- Error
example #2
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;<- Error
}
Please help me with sample coding so that I will learn logically
Thank you
I am using C#NET2008 and EXCEL 2003.
I am trying to set a specific ROW FONT COLOR to COLOR.BLUE on the Spreadsheet.
I have tried 2 different ways after initial error message and both ways are not working.
I do encounter error messages.
-----------------------------------------------------------
Error message:
No overload for method 'this' takes '1' arguments
Coding:
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;
Error message:
'object' does not contain a definition for 'Style' and no extension method 'Style' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Coding:
xlWrksheet.Rows[intRow].Style.Font.Col or = Color.Blue;
-----------------------------------------------------------
//declare Excel object
Excel.Applicati on xlExcel = null;
Excel.Workbook xlWrkBook;
Excel.Worksheet xlWrksheet;
object oMissing = System.Reflecti on.Missing.Valu e;
public void FMethodOpenExce l
{
// declare instantiate Excel Object
xlExcel = new Excel.Applicati on();
xlWrkBook = xlExcel.Workboo ks.Add(oMissing );
xlWrksheet = (Excel.Workshee t)xlWrkBook.Wor ksheets.get_Ite m(1);
//load Excel and define object
xlExcel.Visible = true;
int intRow = 6;
int intCol = 0;
example #1
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;<- Error
example #2
xlWrksheet.Rows[intRow].Font.Color = Color.Blue;<- Error
}
Please help me with sample coding so that I will learn logically
Thank you