Interoperation / Office Integration Topics include: COM, P/Invoke (e.g. Win32 API), marshaling, distributed applications, VBA and interacting with office apps

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > .NET > Interoperation / Office Integration > Excel Border from

Thread Tools Display Modes
Old 12-16-2003, 09:33 AM
wildfire1982 wildfire1982 is offline

Preferred language:
Join Date: Oct 2003
Location: Southampton
Posts: 50
wildfire1982 is on a distinguished road
Default Excel Border from

Hello, i was just wondering if someone knew the code to put a border around a range of cells

Thanks very much

Reply With Quote
Old 01-13-2004, 11:28 AM
nygma nygma is offline

Preferred language:
Join Date: Jan 2004
Posts: 1
nygma is on a distinguished road
Default C# sample

Hello Chris!

It was a while ago, but you may be able to use it anyway. It is a C# sample, but works.

oRng = oSheet.get_Range("A4","E4");
oRng.Font.Bold = true;
oRng.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
oRng.Borders[Excel.XlBordersIndex.xlEdgeBottom].Color = 0;
oRng.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
oRng.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = 2;

oSheet is the WorkSheet object

Rg, Nygma
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel UnderLine Interior Border DiverDan Interoperation / Office Integration 5 09-18-2005 11:21 PM
How can I know the actual border of my excel range BadBoyCholette Interoperation / Office Integration 2 08-01-2004 09:14 AM
Table Backcolor forms border around cell when border is 0 cyclonebri ASP.NET 1 05-21-2004 01:18 PM
Radiobutton w. Border Malfunction Windows Forms 4 12-15-2003 05:57 AM
draw border bwells Windows Forms 1 02-27-2003 04:20 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..