AlastairOz
Technical User
I am using ole automation with excel.
The issue I have is with the borders.
Here is what I am doing
I populate the data like this:
LOCAL nRow
nRow = 5
** populate our excel workbook
** get data
thisform.getreportdata
select cReportData
SCAN
xl.cells(nRow, 1).value = Assetid
xl.cells(nRow, 2).value = Walkorder
xl.cells(nRow, 3).value = ALLTRIM(assettype)
xl.cells(nRow, 4).value = ALLTRIM(size)
xl.cells(nrow, 4).value = ptdate
xl.cells(nrow, 6).value = ALLTRIM(Tagnumber)
xl.cells(nrow, 7).value = ALLTRIM(Location1)
xl.cells(nRow, 8).value = ALLTRIM(Location2)
xl.cells(nrow, 9).value = ALLTRIM(Location3)
** increment the row counter
nRow = nRow + 1
ENDSCAN
For the Borders I have 3 methods similar to this:
(I have a #DEFINE list as well)
xl.RANGE("A6:E32").Select
xl.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
xl.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With xl.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
EndWith
The other 2 methods just change the range selection:
xl.RANGE("F6:H32").Select
xl.RANGE("I6
32").Select
This covers the whole row and page and enables me to have the lines in various thicknesses as required.
What I want to do is populate the spreadsheet, keep the
various border styles, but only show the borders where the records exist.
Is there a way I can do this?
PS (I was able to do it, but I lost the line thickness: all
the borders were the same.)
I added extra lines in the scan code:
SCAN
xl.cells(nRow, 1).value = Assetid
xl.cells(nRow, 1).borders.LineStyle = xlContinuous
xl.cells(nRow, 1).borders.Weight = xlThin
etc
But the code needs to be like the methods above, and using
a variable somehow for the row.
Any help would be appreciated
Regards
Alastair
The issue I have is with the borders.
Here is what I am doing
I populate the data like this:
LOCAL nRow
nRow = 5
** populate our excel workbook
** get data
thisform.getreportdata
select cReportData
SCAN
xl.cells(nRow, 1).value = Assetid
xl.cells(nRow, 2).value = Walkorder
xl.cells(nRow, 3).value = ALLTRIM(assettype)
xl.cells(nRow, 4).value = ALLTRIM(size)
xl.cells(nrow, 4).value = ptdate
xl.cells(nrow, 6).value = ALLTRIM(Tagnumber)
xl.cells(nrow, 7).value = ALLTRIM(Location1)
xl.cells(nRow, 8).value = ALLTRIM(Location2)
xl.cells(nrow, 9).value = ALLTRIM(Location3)
** increment the row counter
nRow = nRow + 1
ENDSCAN
For the Borders I have 3 methods similar to this:
(I have a #DEFINE list as well)
xl.RANGE("A6:E32").Select
xl.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
xl.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With xl.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
EndWith
With xl.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
EndWith
The other 2 methods just change the range selection:
xl.RANGE("F6:H32").Select
xl.RANGE("I6
This covers the whole row and page and enables me to have the lines in various thicknesses as required.
What I want to do is populate the spreadsheet, keep the
various border styles, but only show the borders where the records exist.
Is there a way I can do this?
PS (I was able to do it, but I lost the line thickness: all
the borders were the same.)
I added extra lines in the scan code:
SCAN
xl.cells(nRow, 1).value = Assetid
xl.cells(nRow, 1).borders.LineStyle = xlContinuous
xl.cells(nRow, 1).borders.Weight = xlThin
etc
But the code needs to be like the methods above, and using
a variable somehow for the row.
Any help would be appreciated
Regards
Alastair