We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Styling an entire header row

I'm trying to generate a report that needs a header style (solid background, thin border on the bottom) that spans the entire length of a row in a worksheet.

The best I can seem to do is style a fixed range of cells in a row. Is there any way to apply a style to an entire row without having an existing template document?

I've tried code like the following, which only styles cells that have content in them:

var style = sheet.Rows[0].CellStyle;
style.FillPattern = ExcelPattern.Solid;
style.Font.Bold = true;
style.ColorIndex = ExcelKnownColors.Grey_40_percent;
var border = style.Borders[ExcelBordersIndex.EdgeBottom];
border.Color = ExcelKnownColors.Black;
border.LineStyle = ExcelLineStyle.Thin;

2 Replies

DA DanHerbert February 3, 2010 01:40 AM UTC

Nevermind, I figured out the solution. I needed to call:

sheet.SetDefaultRowStyle(1, style);

To apply a style to an entire row.


MP Manimala P Syncfusion Team February 3, 2010 06:54 AM UTC

Hi Danherbert,

Thanks for your interest in Syncfusion products.

We are glad to hear that the problem has been solved.Thanks for the update.Please let me know if you have any other queries.

Regards,
Manimala.

Loader.
Live Chat Icon For mobile
Up arrow icon