2008/11/19 Aleksandar Urošević <[&#1045;-&#1055;&#1054;&#1064;&#1058;&#1040; 
&#1047;&#1040;&#1064;&#1058;&#1048;&#1035;&#1045;&#1053;&#1040;]>
> A da li može taj makro da se napiše u Perlu? Šta on zapravo radi?

Koliko sam skontao, korisiti već postojeći UNO API za korisničke
rečnike i stavku po stavku upisuje u tekstualnu datoteku. Znači jako
jednostavno i u principu samo čupanje stavki radi ok, samo što UTF-8
ispis ne radi. Evo i koda:

Sub ExportDictionary

        'Get DictionaryList UNO service
        oList = createUnoService ("com.sun.star.linguistic2.DictionaryList")

        'Open text file with words to be added (one word per line)      
        iFileNo = FreeFile
        sURL = ConvertToURL (oDlg.getControl ("txtFile").Text)
        open sURL for output as iFileNo

        'Get dictionary object
        sDicName = oDlg.getControl ("cboDicChooser").Text
        oDic = oList.GetDictionaryByName (sDicName)

        'Go through dictionary
        for iWord = LBound (oDic.Entries) to UBound (oDic.Entries)
                'Write word to text file
                print #iFileNo, oDic.Entries (iWord).DictionaryWord
                'Display status
                oDlg.getControl ("lblStatus").Text = "Exporting: word " & iWord 
+ 1
& " of " & oDic.Count
        next iWord

        oDlg.getControl ("lblStatus").Text = "Finished. " & oDic.Count & "
words exported"
        MsgBox oDic.Count & " words were exported from " & sDicName
        
        'Close text file
        close #iFileNo
        
End Sub

Znači petlja radi ok, i oDic.Entries (iWord).DictionaryWord vraća
ispravne reči iz rečnika, samo print izgleda ne radi posao...

Pozdrav,
M

Одговори путем е-поште