Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating Borders in Excel with Delphi ?

2,067 views
Skip to first unread message

Paul Elias

unread,
Jan 25, 2001, 10:19:11 PM1/25/01
to
I am currently using Delphi 5 Professional and Excel 2000, and am outputting
Paradox Data to an Excel Spreadsheet.

My problem is, how do I format/create cell borders so that the top of a
range of cells has a single continuous border, and the bottom of the same
cells has a double continuous border.

I have tried the following, as well as other commands, But they either do
nothing, or do not produce
the effect I am after. I basically want to be able to apply a thin
continuous line to the top of cells
in a range, and a thick continuous line to the bottom of the same cells in
the range, ie for Totals
and SubTotals.

XLWsheet.Range[Var1,Var2].Borders.LineStyle:=xlContinuous;
XLWsheet.Range[Var1,Var2].Borders.Value:=xlEdgeBottom;
XLWsheet.Range[Var1,Var2].Borders.Weight:=xlThick;

XLWsheet.Range[Var1,Var2].BorderAround(xlContinuous,xlThin,xlAutomatic,xlAut
omatic);

I have looked at the infamous Deborah Pate page at
http://www.djpate.freeserve.co.uk/ but it just falls short on showing how to
apply
borders, I have also looked through various other sites with no luck.

Could someone please provide an Example or point me to another website

Below is Code from a Recorded EXCEL Macro, but how do I convert it to Delphi

Range("C10:L10").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Range("C14").Select

regards

pe.


Deborah Pate (TeamB)

unread,
Jan 27, 2001, 4:11:39 PM1/27/01
to
<<Paul Elias:

My problem is, how do I format/create cell borders so that
the top of a range of cells has a single continuous border,
and the bottom of the same cells has a double continuous
border.
>>

Nearly there, but you have to use the Item method to
specify the border you want to change:

WS.Range['A5', 'D5'].Borders.Item[xlEdgeTop].Linestyle
:= xlContinuous;
WS.Range['A5', 'D5'].Borders.Item[xlEdgeBottom].Linestyle
:= xlDouble;

--
Deborah Pate (TeamB) http://delphi-jedi.org

Use Borland servers; TeamB don't see posts via ISPs
http://www.borland.com/newsgroups/genl_faqs.html


Paul Elias

unread,
Jan 28, 2001, 5:58:12 AM1/28/01
to
Many Thanks.

PE.


"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
message news:VA.000008f...@cableinet.co.not-this-bit.uk...

0 new messages