Setting Excel range font etc styles using C#
Hi everybody...
I am developing a Windows application in C# to automate excel. I push rows from datagridview to the excel sheet. I have some cells in datagridview that haveBold font, and can be inItalicsalso. How can set the excel cells font style (bold or italics) the same as it is in datagridview.
I tried this and it is giving an error:
((
Range)objSheet.Cells[sheetRowIndex, 1]).Font.Bold = dataGridViewPricing.Rows[sheetRowIndex - 12].Cells["PartNumber"].Style.Font.Bold;The error:
Object reference not set to an instance of an object.
Thanks.
Bullpit

