简体   繁体   English

使用宏设置单元格样式

[英]Styling cells with macro

I'm new with OO Calc macros.我是 OO Calc 宏的新手。 With this code I can style cells on F13:F16 range使用此代码,我可以在F13:F16范围内设置单元格样式

REM  *****  BASIC  *****
Option Explicit

Sub Main
oDoc = ThisComponent
osheets = odoc.getSheets()
osheet = osheets.getByIndex(0)
oCells = oSheet.getCellRangeByName("F13:F16")
NewBorder = oCells.BottomBorder
NewBorder.OuterLineWidth = 3
oCells.BottomBorder = NewBorder
End Sub

How can I edit this code so I can style cells I currently selected with mouse, instead of specifying them in the code?如何编辑此代码,以便我可以设置当前使用鼠标选择的单元格的样式,而不是在代码中指定它们?

Working with selected cells is a bit complex because either a single cell, a cell range, or multiple cell ranges may be selected.使用选定的单元格有点复杂,因为可以选择单个单元格、一个单元格范围或多个单元格范围。

Code that handles all of these possibilities is explained in the essential Andrew's Macro Document under section 6.5.1.处理所有这些可能性的代码在6.5.1节下的基本Andrew 的宏文档中进行了解释。 Simple example processing selected cells .处理选定单元格的简单示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM