OpenOffice Basic
来源:互联网 发布:怎么得到知乎live礼券 编辑:程序博客网 时间:2024/05/18 02:29
How to find/replace with hyperlinks in Writer 怎样获取超链接
sub markHyperlink
dim oParaEnum as object
dim oPortEnum as object
dim oPara as object
dim oPort as objectoParaEnum = thisComponent.text.createEnumeration()
do while oParaEnum.hasMoreElements()
oPara = oParaEnum.nextElementif oPara.supportsService("com.sun.star.text.Paragraph") then
rem if you're sure you'll never use a table for whatever reason, you can get rid of this if clause
oPortEnum = oPara.createEnumerationdo while oPortEnum.hasMoreElements()
oPort = oPortEnum.nextElement()if isHyperlink(oPort) then
rem please note that 'isHyperlink()' is a stand in for however you end up determining whether something is a hyperlink
thisComponent.text.insertString(oPort.getStart(), ">>", false)
endifloop
endif
loopend sub
function isHyperlink(oTextPortion as object) as boolean
with oTextPortion
if .hyperlinkTarget = "" and .hyperlinkName = "" and .hyperlinkURL = "" then
isHyperlink = false
else
isHyperlink = true
endif
end with
end function
How to output string to file with Star Basic
input1 = text.dbg_methods
n = FreeFile 'Always find the next free file number
FileName = ConvertToURL(CurDir) & "/delme.txt"
Open FileName For Output As #n
Write #n, input1
close #n
How to modify the border of texttable in openoffice word processing
Sub Main
' oDoc = ThisComponent
oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0, Array()
' Create a table
oTable = oDoc.createInstance( "com.sun.star.text.TextTable" )
' Initialise table to have seven rows, five columns
oTable.initialize( 7, 5 )
' Get view cursor
oViewCursor = oDoc.getCurrentController().getViewCursor()
' Get text of the document.
oText = oDoc.getText()
'Insert table into text at current view cursor position.
oText.insertTextContent( oViewCursor, oTable, False )
' Now let's have some fun with the table.
' Fill in all the cells.
For nRow = 0 To oTable.getRows().getCount() - 1
For nCol = 0 To oTable.getColumns().getCount() - 1
oCell = oTable.getCellByPosition( nCol, nRow )
' Get the cell's text.
oText = oCell.getText()
' Get a cursor on the cell's text.
oCursor = oText.createTextCursor()
' Insert something random
oText.insertString( oCursor, "$"+CSTR( Int( Rnd() * 10000 ) ), False )
' For some rows, make the number format be Currency.
If nRow <= 3 Then
oCell.NumberFormat = com.sun.star.util.NumberFormat.CURRENCY
Else
oCell.NumberFormat = com.sun.star.util.NumberFormat.TEXT
EndIf
oCell.LeftBorder = MakeCellBorderLine( RGB(255,255,255), 0, 10, 0 )
oCell.RightBorder = MakeCellBorderLine( RGB(255,255,255), 0, 10, 0 )
oCell.TopBorder = MakeCellBorderLine( RGB(255,255,255), 0, 10, 0 )
oCell.BottomBorder = MakeCellBorderLine( RGB(255,255,255), 0, 10, 0 )
Next
Next
End Sub
Function MakeCellBorderLine( nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance ) _
As com.sun.star.table.BorderLine
oBorderLine = createUnoStruct( "com.sun.star.table.BorderLine" )
With oBorderLine
.Color = nColor
.InnerLineWidth = nInnerLineWidth
.OuterLineWidth = nOuterLineWidth
.LineDistance = nLineDistance
End With
MakeCellBorderLine = oBorderLine
End Function
Question: Why we can not modify the border using these code:
oCell.BottomBorder .Color = rgb(128,0,200) and so on.
20110414
TextField of OpenOffice swriter can be a password control by Only changing the Model.EchoChar to specific char.
- OpenOffice Basic
- OpenOffice
- OpenOffice
- OpenOffice
- @Basic
- Basic
- Basic
- BASIC
- @Basic
- @Basic
- basic
- openoffice 2.01
- openoffice 安装
- 加速openoffice
- openoffice 3.0
- openOffice开发
- openoffice二三事
- OpenOffice.org
- 解决:Labview 中程序框图中选取仪器I/O助手时出现提示'I/O助手未安装问题'
- 开发感想——之一
- java RMI的简单使用
- Java5的线程池分好多种:固定尺寸的线程池、可变尺寸连接池
- mvc 第二步,第一个页面
- OpenOffice Basic
- 二、CXF 入门示例
- mvc 第三步,全局观
- KMP 算法 自己的一些理解
- Spring Controller应用举例
- 关于ORACLE COMMIT操作的详解—转
- linux下定时使用rman总结
- asp.net页面事件执行顺序
- 性能测试-理发店模型