選択範囲をpタグで囲むマクロ。
改行はbrタグで記事を書こうと思っていたわけですが、やっぱりパラグラフはpタグの方がレイアウトしやすいなと思って、pタグも準備しました。ソース的には新鮮さゼロですが。
ついでに個人的にはすーごく気持ち悪かったbloggerの記事を囲んでいたpタグも外してしまいました(ウィジットテンプレートをぽーっと見ていて、やっとどこで設定しているのかわかりました。ふー、スッキリ。更に調子に乗って「ウィジットのテンプレートを展開」にチェックを入れて、ウィジットのタグもいじってみましたが、こちらはことごとくエラーになりました。あー改造したい…)。
Dim intXB '選択範囲の最終行のX
Dim intYC '現在位置のY
Dim intYA '選択範囲の開始行
Dim intYB '選択範囲の最終行
Dim i
intYC = document.selection.GetActivePointY( eePosLogical )
intXB = document.selection.GetBottomPointX( eePosLogical )
intYA = document.selection.GetAnchorPointY( eePosLogical )
intYB = document.selection.GetBottomPointY( eePosLogical )
If intXB = 1 Then
intYB = intYB -1
If intYC > 1 Then intYC = intYC - 1
End If
If intYC <> intYB Then
For i = intYC To intYB
document.selection.StartOfLine False,eeLineLogical
document.selection.Text="<p>"
document.selection.EndOfLine False,eeLineLogical
document.selection.Text="</p>"
document.selection.LineDown
Next
Else
For i= intYA to intYB
document.selection.StartOfLine False,eeLineLogical
document.selection.Text="<p>"
document.selection.EndOfLine False,eeLineLogical
document.selection.Text="</p>"
document.selection.LineDown
Next
End If
0 件のコメント:
コメントを投稿