Setting Excel 2003 borders programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to suss out exactly how to assign borders to cells via C# into an
Excel 2003 spreadsheet. I've been tinkering some more last night (Aussie
time) and managed to figure out a lot more in regards to doing this kind of
thing (Self-teaching can really suck sometimes) - Much thanks to the kind
soul who helped me out yesterday - and the sheet I'm creating is essentially
done. There is just a few points which aren't quite right because the only
borders I can set are around the entire cell - Not just, say, the bottom.
 
Hi Damian,

I got few experiences with Excel automation.
Let get back to the previous post and add this line.
Excel.Range range = ws.get_Range(ws.Cells[1,1],ws.Cells[1,2]);
range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;

Cheers,
Kids
 
Excel.Range range = ws.get_Range(ws.Cells[1,1],ws.Cells[1,2]);
range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;
I tried something similar to this and it put a border around each cell. Tis
cool, I didn't realise it could be done that way, but what I was after was
borders around only the outside (No inside lines), and just the bottom line
on a few cells as well.

Or have I done something not quite right? (Good chance that is the case).
 
Back
Top