Re: [oodisc] Границы ячеек
Vladimir
vbux на artmed.ru
Чт Сен 11 11:17:42 MSD 2003
Добрый день,
ПАЛ> Подскажите, пожалуйста, как задать в макросе для scalc границу (тип,
ПАЛ> толщину линии) ячейки
В качестве примера можете посмотреть мой кусочек кода. Он не снабжен
коментариями, но там все достаточно просто.
С уважением,
Владимир Бухал <vbux на artmed.ru>
начальник тех. отдела ООО "Арт Медия"
г. Воронеж, ул. Театральная, 34
тел./факс: +7(0732) 519-281,519-434,559-039
----------- следущая часть -----------
Sub main()
Dim oCells, oSheet, oDocument As Object
oDocument = ThisComponent
oSheet=ThisComponent.Sheets.GetByIndex(0)
oCells=oSheet.GetCellRangeByName("A2:C6")
SetupBorder(oCells,3)
End Sub
sub SetupBorder(oCellRange as Object,BorderType as integer)
oWideLine = CreateUnoStruct("com.sun.star.table.BorderLine")
With oWideLine
.Color = 0
.InnerLineWidth = 0
.OuterLineWidth = 88
.LineDistance = 0
End With
oThikLine = CreateUnoStruct("com.sun.star.table.BorderLine")
With oThikLine
.Color = 0
.InnerLineWidth = 0
.OuterLineWidth = 2
.LineDistance = 0
End With
oMiddleLine = CreateUnoStruct("com.sun.star.table.BorderLine")
With oMiddleLine
.Color = 0
.InnerLineWidth = 0
.OuterLineWidth = 35
.LineDistance = 0
End With
oTableBorder = createUnoStruct("com.sun.star.table.TableBorder")
if BorderType=1 Then
With oTableBorder
.TopLine = oWideLine
.IsTopLineValid = True
.BottomLine = oWideLine
.IsBottomLineValid = True
.LeftLine = oWideLine
.IsLeftLineValid = True
.RightLine = oWideLine
.IsRightLineValid = True
.HorizontalLine = oThikLine
.IsHorizontalLineValid = True
.VerticalLine = oThikLine
.IsVerticalLineValid = True
.Distance = 0
.IsDistanceValid = True
End With
elseif BorderType=2 then
With oTableBorder
.TopLine = oWideLine
.IsTopLineValid = True
.BottomLine = oWideLine
.IsBottomLineValid = True
.LeftLine = oWideLine
.IsLeftLineValid = True
.RightLine = oWideLine
.IsRightLineValid = True
.HorizontalLine = oThikLine
.IsHorizontalLineValid = false
.VerticalLine = oThikLine
.IsVerticalLineValid = True
.Distance = 0
.IsDistanceValid = True
End With
elseif BorderType=3 then
With oTableBorder
.TopLine = oWideLine
.IsTopLineValid = True
.BottomLine = oWideLine
.IsBottomLineValid = True
.LeftLine = oWideLine
.IsLeftLineValid = True
.RightLine = oWideLine
.IsRightLineValid = True
.HorizontalLine = oWideLine
.IsHorizontalLineValid = True
.VerticalLine = oWideLine
.IsVerticalLineValid = True
.Distance = 0
.IsDistanceValid = True
End With
elseif BorderType=4 then
With oTableBorder
.TopLine = oWideLine
.IsTopLineValid = True
.BottomLine = oWideLine
.IsBottomLineValid = True
.LeftLine = oWideLine
.IsLeftLineValid = True
.RightLine = oWideLine
.IsRightLineValid = True
.HorizontalLine = oWideLine
.IsHorizontalLineValid = false
.VerticalLine = oWideLine
.IsVerticalLineValid = false
.Distance = 0
.IsDistanceValid = True
End With
else
With oTableBorder
.TopLine = oThikLine
.IsTopLineValid = True
.BottomLine = oThikLine
.IsBottomLineValid = True
.LeftLine = oThikLine
.IsLeftLineValid = True
.RightLine = oThikLine
.IsRightLineValid = True
.HorizontalLine = oThikLine
.IsHorizontalLineValid = false
.VerticalLine = oThikLine
.IsVerticalLineValid = false
.Distance = 0
.IsDistanceValid = True
End With
End if
oCellRange.TableBorder = oTableBorder
End Sub
Подробная информация о списке рассылки Oo-discuss