OpenOffice.org/LibreOffice Writerのマクロで下線を引くためのサブルーチン。
下線を引き始める前にこのサブルーチンを呼んで、引き終わりたいところでpsULTypeを”NONE”にして呼んでした線を引きます。
' 種別: NONE, SINGLE, DOUBLE, DOTTED, DONTKNOW, DASH, LONGDASH, DASHDOT, DASHDOTDOT, ' SMALLWAVE, WAVE, DOUBLEWAVE, BOLD, BOLDDOTTED, BOLDDASH, BOLDLONGDASH, ' BOLDDASHDOT, BOLDDASHDOTDOT, BOLDWAVE ' com.sun.star.awt.FontUnderline Sub Sb_SetUnderLine( poCursor As Object, poText As Object, psULType As String ) Dim oSel As Object oSel = poText.createTextCursorByRange(poCursor ) Select Case psULType Case "NONE", "none", "None" oSel.CharUnderline = com.sun.star.awt.FontUnderline. NONE Case "SINGLE", "single", "Single" oSel.CharUnderline = com.sun.star.awt.FontUnderline. SINGLE Case "DOUBLE", "Double", "double" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DOUBLE Case "DOTTED", "Dotted", "dotted" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DOUBLE Case "DONTKNOW", "Dontknow", "DontKnow", "dontknow" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DONTKNOW Case "DASH", "Dash", "dash" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DASH Case "LONGDASH", "LongDash", "Longdash", "longdash" oSel.CharUnderline = com.sun.star.awt.FontUnderline. LONGDASH Case "DASHDOT", "DashDot", "Dashdot", "dashdot" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DASHDOT Case "DASHDOTDOT", "DashDotDot", "Dashdotdot", "dashdotdot" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DASHDOTDOT Case "SMALLWAVE", "SmallWave", "Smallwave", "smallwave" oSel.CharUnderline = com.sun.star.awt.FontUnderline. SMALLWAVE Case "WAVE", "Wave", "wave" oSel.CharUnderline = com.sun.star.awt.FontUnderline. WAVE Case "DOUBLEWAVE", "DoubleWave", "Doublewave", "doublewave" oSel.CharUnderline = com.sun.star.awt.FontUnderline. DOUBLEWAVE Case "BOLD", "Bold", "bold" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLD Case "BOLDDOTTED", "BoldDotted", "Bolddotted", "bolddotted" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDDOTTED Case "BOLDDASH", "BoldDash", "Bolddash", "bolddash" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDDASH Case "BOLDLONGDASH", "BoldLongDash", "Boldlongdash", "boldlongdash" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDLONGDASH Case "BOLDDASHDOT", "BoldDashDot", "Bolddashdot", "bolddashdot" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDDASHDOT Case "BOLDDASHDOTDOT", "BoldDashDotDot", "Bolddashdotdot", "bolddashdotdot" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT Case "BOLDWAVE", "BoldWave", "Boldwave", "boldwave" oSel.CharUnderline = com.sun.star.awt.FontUnderline.BOLDWAVE Case Else Msgbox("Sb_SetUnderLine(): 間違った引数が渡されました。 psULType=[" & psULType & "]" ) End Select ' psULType End Sub