Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Set Cell Border in Excel Export
posted

I am trying to set the cell border in the excel export.

I basically just want a right border for all columns.

I have tried adding to the "BeginExport" event to test just the first column:

e.CurrentWorksheet.Columns[0].CellFormat.LeftBorderStyle = Infragistics.Excel.CellBorderLineStyle.None;
e.CurrentWorksheet.Columns[0].CellFormat.RightBorderStyle = Infragistics.Excel.CellBorderLineStyle.Default;
e.CurrentWorksheet.Columns[0].CellFormat.TopBorderStyle = Infragistics.Excel.CellBorderLineStyle.None;
e.CurrentWorksheet.Columns[0].CellFormat.BottomBorderStyle = Infragistics.Excel.CellBorderLineStyle.None;

 

I al tried the same thing in the "endExport" event, both didn't work.

Then I tried in the "InitializeColumn" event:

e.Column.CellStyle.BorderDetails.StyleLeft = BorderStyle.None;
e.Column.CellStyle.BorderDetails.StyleBottom = BorderStyle.None;
e.Column.CellStyle.BorderDetails.StyleTop = BorderStyle.None;
e.Column.CellStyle.BorderDetails.StyleRight = BorderStyle.Solid;

 

This seemed to do nothing either.

Is there some way to control this?

Thanks