Created
March 18, 2014 15:21
-
-
Save toofikam/9622188 to your computer and use it in GitHub Desktop.
Macro (LibreOffice) for Underlining specific author in Bibliography
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub UnderlineAuthors | |
rem ---------------------------------------------------------------------- | |
rem define variables | |
dim document as object | |
dim dispatcher as object | |
rem --- Modify here the variable for number of authors (that is used hereafter in the macro in the for loop) | |
dim authors(37) as string | |
dim i As Integer | |
authors(0)="TOOFIK AM" | |
authors(1)="ANOTHER ONE" | |
rem --- etc.... | |
rem ---------------------------------------------------------------------- | |
rem get access to the document | |
document = ThisComponent.CurrentController.Frame | |
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") | |
dim args1(18) as new com.sun.star.beans.PropertyValue | |
dim args2(0) as new com.sun.star.beans.PropertyValue | |
args2(0).Name = "Underline.LineStyle" | |
args2(0).Value = 1 | |
For i = 0 To 37 | |
args1(0).Name = "SearchItem.StyleFamily" | |
args1(0).Value = 2 | |
args1(1).Name = "SearchItem.CellType" | |
args1(1).Value = 0 | |
args1(2).Name = "SearchItem.RowDirection" | |
args1(2).Value = true | |
args1(3).Name = "SearchItem.AllTables" | |
args1(3).Value = false | |
args1(4).Name = "SearchItem.Backward" | |
args1(4).Value = false | |
args1(5).Name = "SearchItem.Pattern" | |
args1(5).Value = false | |
args1(6).Name = "SearchItem.Content" | |
args1(6).Value = false | |
args1(7).Name = "SearchItem.AsianOptions" | |
args1(7).Value = false | |
args1(8).Name = "SearchItem.AlgorithmType" | |
args1(8).Value = 0 | |
args1(9).Name = "SearchItem.SearchFlags" | |
args1(9).Value = 65536 | |
args1(10).Name = "SearchItem.SearchString" | |
args1(10).Value = authors(i) | |
args1(12).Name = "SearchItem.Locale" | |
args1(12).Value = 255 | |
args1(13).Name = "SearchItem.ChangedChars" | |
args1(13).Value = 2 | |
args1(14).Name = "SearchItem.DeletedChars" | |
args1(14).Value = 2 | |
args1(15).Name = "SearchItem.InsertedChars" | |
args1(15).Value = 2 | |
args1(16).Name = "SearchItem.TransliterateFlags" | |
args1(16).Value = 1280 | |
args1(17).Name = "SearchItem.Command" | |
args1(17).Value = 1 | |
args1(18).Name = "Quiet" | |
args1(18).Value = true | |
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1()) | |
dispatcher.executeDispatch(document, ".uno:Underline", "", 0, args2()) | |
Next i | |
end sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment