This is a migrated thread and some comments may be shown as answers.

ExporttoExcel With Border

1 Answer 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Prashant goyani
Top achievements
Rank 1
Prashant goyani asked on 09 Jul 2009, 08:23 PM
Hi ,

I have a Release Q2 2009 . I  m using ExcelCellFormattingExventArgs using that i m able to create border in cell only on single side(left, top, right,bottom) but i want to create border in all four side.i m using wincontrol.so can you help me that how can i do border all side in cell.can you reply ASAP.

Thanks,
Prashant

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 14 Jul 2009, 05:01 PM
Hi Prashant goyani,

Thank you for the questions. You can add BorderStyles elements to the ExcelStyleElement.Borders collection for every excel cell side:
void exporter_ExcelCellFormatting(object sender, ExcelCellFormattingEventArgs e)  
{  
      e.ExcelStyleElement.Borders.Add(new BorderStyles(PositionType.Bottom));  
      e.ExcelStyleElement.Borders.Add(new BorderStyles(PositionType.Top));  
      e.ExcelStyleElement.Borders.Add(new BorderStyles(PositionType.Left));  
      e.ExcelStyleElement.Borders.Add(new BorderStyles(PositionType.Right));  
 
      foreach (BorderStyles style in e.ExcelStyleElement.Borders)  
      {  
           style.Color = Color.Black;  
           style.LineStyle = LineStyle.Continuous;  
           style.Weight = 1;  
      }  

Write me back if you have other questions.

Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Prashant goyani
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or