working on it ...

Filters

Explore Public Snippets

Sort by

Found 52 snippets matching: openoffice

    public by lbottaro  463514  0  7  0

    Excel function to calculate the average of positive data in range

    This excel function calculate the average of a specific range of cells, regarding only positive values. Zero or less than zero value won't be used in average calculation. The italian version of this snippet can be used as well on OpenOffice 3.
    =SUMIF(B2:B6;">0")/MAX(COUNTIF(B2:B6;">0");1)
    
    # Italian version
    =SOMMA.SE(B2:B6;">0")/MAX(CONTA.SE(B2:B6;">0");1)

    public by msdn  1005  0  6  0

    OpenOfficeSpreadsheet

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Aspose.Cells;
    
    static void OpenOfficeSpreadsheet()
    {
         string MyDir = @"Files\";
        Workbook workbook = new Workbook(MyDir+"sample.ods");
        workbook.Save(MyDir + "Converted from ODS to XLS.xlsx",SaveFormat.Xlsx);
    }

    external by Bastiaan Nelissen  57  0  1  0

    Macro allow using of markdown syntax while writing in LibreOffice or OpenOffice

    Macro allow using of markdown syntax while writing in LibreOffice or OpenOffice: OOMarkdown.bas
    '*** Markdown formatter for Libre(open)Office ****
    '    (pre-alpha-demo)
    '    Author: Jeka twoweeksgame@gmail.com
    '    License: No any warranties blah blah blah...
    '             Send me real postcard if you Like to use it 
    '
    '    Features: format headers verbatim blocks and formulas 
    '             according to Markdown syntax
    '
    '    Install:  Open Tools->Macros->Organize Macros->LibreOffice Basic
    '              Click [New]
    '              In appeared field type OOMarkdown (or smth other no matter)
    '              After pressing [OK] the Basic editor appears. 
    '              Remove all existing content there and copy&paste this text.
    '              Save the macro. Now you can call it via "LibreOffice Basic" 
    '              menu or bind the hotkey. RTFM about macros.
    
    Option Explicit
    '*** Style names used for foratting ***
    Private Const preformatted ="Preformatted Text"
    Private Const header ="Heading "
    
    Sub Main
    	replaceHeader
    	replaceCode
    	replaceMath
    End Sub
    
    '*** Headers ***
    ' Apply heading syle to strings starting with some # chars
    ' # -> Heading 1
    ' ## -> Heading 2
    ' ### -> Heading 3
    ' And so on 
    Sub replaceHeader
    	Dim searchMark,searchText
     	searchMark=regSearch("^#+")
     	searchText=regSearch(".*$")
    	Dim foundMark,foundText
      	foundMark = doc.findFirst(searchMark)
      	While NOT IsNull(foundMark)
      		Dim headlevel
      		headLevel=len(trim(foundMark.getString))
      		If headLevel>5 Then
      			headLevel=5
      		End if
      		foundText=doc.findNext(foundMark,searchText)
      		foundText.ParaStyleName=header & headlevel
      		Dim hs: hs=Trim(foundText.getString)
      		foundMark.setString("")
      		foundText.setString(hs)
      		foundMark = doc.findNext(foundText,searchMark)
      	Wend 
    End Sub
    
    '*** Code blocks ***
    ' Apply preformatted style to text block between lines of tildas.
    ' Also remove paragraph breaks in that block.
    Sub replaceCode
      Dim search
      search=regSearch("^~~+$")
      Dim found1,found2
      found1 = doc.findFirst(search)
      If Not IsNull(found1) Then
        found2 = doc.findNext(found1,search)
      End If
      While NOT IsNull(found1) And Not IsNull(found2)
       	found1.setString("")
       	found2.setString("")
       	found1.gotoRange(found2,True)
       	found1.ParaStyleName=preformatted
       	Dim str
       	'Paragraph breaks are CRLF 
       	'we need just linebreaks without breaking paragraph - LF
       	'so we remove all CR - Chr(13)
       	str=Join(Split(found1.getString(),Chr(13)),"")
       	str=mid(str,2,len(str)-3) 'Indexes in string begin with 1. WTF?!
       	found1.setString(str)
          	found1 = doc.findNext(found2,search)
          	If Not IsNull(found1) Then
          		found2 = doc.findNext(found1,search)
          	End if
      Wend
      
    End Sub
    
    '*** Formulas ***
    ' Convert text between two $ chars to formula object.
    ' Text must be in OpenOffice Math language.
    ' Annoyingly tricky implementation...
    Sub replaceMath
    	Dim search
     	search=regSearch("\$.*\$")
     	Dim found
      	found = doc.findFirst(search)
      	While NOT IsNull(found)
      		Dim mathStr
      		mathStr=found.getString()
      		mathStr=Mid(mathStr,2,Len(mathStr)-2) 'WTF again!
      		Dim math
      		math = doc.createInstance("com.sun.star.text.TextEmbeddedObject")
      		'set type of object by setting UUID. Very intuitive... 
    		math.CLSID = "078B7ABA-54FC-457F-8551-6147e776a997"
    		math.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER 
    		doc.getText.insertTextContent(found, math, true)
    		math.Model.formula = mathStr
    		'resize formula according paragraph text height
    		math.Model.BaseFontHeight=Int(math.Anchor.CharHeight)
    		'we need to use undocumented interface to perform such simple task?!
    		math.ExtendedControlOverEmbeddedObject.update()
    		found = doc.findNext(found,search)
      	Wend 
    
    End Sub
    
    'sugar for search patterns
    Function regSearch(str)
    	Dim search
    	search = doc.createSearchDescriptor
    	search.SearchRegularExpression = TRUE
    	search.SearchString=str
    	regSearch=search
    End Function
    
    'sugar for getting current document
    Function doc
    	doc = ThisComponent
    End Function
    
    
    

    external by luzfcb  2072  10  4  1

    libreoffice / openoffice headless init start/stop process

    libreoffice / openoffice headless init start/stop process: libreoffice
    #!/bin/bash
    # libreoffice.org  headless server script
    #
    # chkconfig: 2345 80 30
    # description: headless libreoffice server script
    # processname: libreoffice
    # 
    # Author: Vic Vijayakumar
    # Modified by Federico Ch. Tomasczik
    # Modified by Manuel Vega Ulloa
    # Modified by Sergey Podushkin
    # Modified by Fábio Caritas Barrionuevo da Luz
    # Baseado em: http://superuser.com/questions/542237/init-d-script-for-openoffice-libreoffice-headless-does-not-stop-process
    
    OOo_HOME=/usr/bin
    SOFFICE_PATH=$OOo_HOME/soffice
    PIDFILE=/var/run/libreoffice-server.pid
    set -e
    
    case "$1" in
        start)
        if [ -f $PIDFILE ]; then
          echo "LibreOffice headless server has already started."
          sleep 5
          exit
        fi
          echo "Starting LibreOffice headless server"
          $SOFFICE_PATH --headless --nologo --nofirststartwizard --    accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
          PID=`ps ax|grep "soffice.bin --headless"|grep -v grep|cut -d \  -f 1`
          echo $PID> $PIDFILE
        ;;
        stop)
        if [ -f $PIDFILE ]; then
          echo "Stopping LibreOffice headless server."
          kill `cat $PIDFILE`
          rm -f $PIDFILE
          exit
        fi
          echo "LibreOffice headless server is not running."
          exit
        ;;
        *)
        echo "Usage: $0 {start|stop}"
        exit 1
    esac
    
    

    external by kuldikin  2272  0  4  0

    OpenOffice macros. Makes all images in .odt file available offline.

    OpenOffice macros. Makes all images in .odt file available offline.: makeImgOffline
    Sub Main 
      'Inspect ThisComponent.getDrawPage() 
      ConvertAllLinkedGraphics 
    End Sub 
    
    Sub ConvertAllLinkedGraphics(Optional aDoc) 
      Dim oDoc        ' Working document 
      Dim oDP         ' Draw page 
      Dim i%          ' Index counter 
      Dim oGraph      ' Graph object in the draw page 
      Dim iLinked%    ' Number of linked graphics 
      Dim iEmbedded%  ' Number of embedded graphics 
      Dim iConverted% ' Linked graphics converted to embedded 
      Dim s1$         ' Graphic service name 
      Dim s2$         ' Graphic service name 
    
      REM Only know how to convert these types 
      s1 = "com.sun.star.drawing.GraphicObjectShape" 
      s2 = "com.sun.star.text.TextGraphicObject" 
    
      If IsMissing(aDoc) OR IsNull(aDoc) OR IsEmpty(aDoc) Then 
        oDoc = ThisComponent 
      Else 
        oDoc = aDoc 
      End If 
    
      REM Get the document draw page and then enumerate the graphics. 
      oDP = oDoc.getDrawPage() 
      For i=0 To oDP.getCount()-1 
        oGraph = oDP.getByIndex(i) 
        If oGraph.supportsService(s1) OR oGraph.supportsService(s2) Then 
          If InStr(oGraph.GraphicURL, "vnd.sun") <> 0 Then 
            iEmbedded = iEmbedded + 1 
          Else 
            iLinked = iLinked + 1 
            If EmbedLinkedGraphic_2(oGraph, oDoc) Then 
              iConverted = iConverted + 1 
            End If 
          End If 
        End If 
      Next 
      Print "Found " & iLinked & " linked and " & iEmbedded & _ 
            " embedded graphics and converted " & iConverted 
    End Sub 
    
    ' oDoc - document to contain the image. 
    ' oCurs - Cursor where the image is added 
    ' sURL - URL of the image to insert. 
    ' sParStyle - set the paragraph style to this. 
    Sub EmbedGraphic(oDoc, oCurs, sURL$, sParStyle$) 
      Dim oShape 
      Dim oGraph     'The graphic object is text content. 
      Dim oProvider  'GraphicProvider service. 
      Dim oText 
    
      oShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape") 
      oGraph = oDoc.createInstance("com.sun.star.text.GraphicObject") 
    
      oDoc.getDrawPage().add(oShape) 
    
      oProvider = createUnoService("com.sun.star.graphic.GraphicProvider") 
    
      Dim oProps(0) as new com.sun.star.beans.PropertyValue 
      oProps(0).Name  = "URL" 
      oProps(0).Value = sURL 
    
      REM Save the original size. 
      Dim oSize100thMM 
      Dim lHeight As Long 
      Dim lWidth As Long 
      oSize100thMM = RecommendGraphSize(oProvider.queryGraphicDescriptor(oProps)) 
      If NOT IsNull(oSize100thMM) AND NOT IsEmpty(oSize100thMM) Then 
        lHeight = oSize100thMM.Height 
        lWidth = oSize100thMM.Width 
      End If 
    
      oShape.Graphic = oProvider.queryGraphic(oProps()) 
      oGraph.graphicurl = oShape.graphicurl 
      oGraph.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER 
      oText= oCurs.getText() 
      oText.insertTextContent(oCurs, oGraph, false) 
      oDoc.getDrawPage().remove(oShape) 
    
      If lHeight > 0 AND lWidth > 0 Then 
        Dim oSize 
        oSize = oGraph.Size 
        oSize.Height = lHeight 
        oSize.Width = lWidth 
        oGraph.Size = oSize 
      End If 
      
      ' Set the paragraph style if it is in the document. 
      Dim oStyles 
      oStyles = oDoc.StyleFamilies.getByName("ParagraphStyles") 
      If oStyles.hasByName(sParStyle) Then 
        oCurs.ParaStyleName = sParStyle 
      End If 
    End Sub 
    
    Function EmbedLinkedGraphic_2(oGraph, oDoc) As Boolean 
      REM Author: Andrew Pitonyak 
      Dim sGraphURL$  ' External URL of the graphic. 
      Dim oGraph_2    ' Created graphic. 
      Dim oCurs       ' Cursor where the graphic is located. 
      Dim oText       ' Text object containing graphic. 
      Dim oAnchor     ' Anchor point of the image 
      Dim s1$         ' Graphic service name 
      Dim s2$         ' Graphic service name 
    
      EmbedLinkedGraphic_2 = False 
      If InStr(oGraph.GraphicURL, "vnd.sun") <> 0 Then 
        REM Ignore an image that is already embedded 
        Exit Function 
      End If 
      s1 = "com.sun.star.drawing.GraphicObjectShape" 
      s2 = "com.sun.star.text.TextGraphicObject" 
      If oGraph.supportsService(s1) Then 
        REM I only know how to convert a GraphicObjectShape. 
        REM I do not know how to convert a TextGraphicObject, 
        REM but it is probably related to the ImageMap attribute. 
        oAnchor = oGraph.getAnchor() 
        oText = oAnchor.getText() 
      
        oGraph_2 = ThisComponent.createInstance(s) 
        oGraph_2.GraphicObjectFillBitmap = oGraph.GraphicObjectFillBitmap 
        oGraph_2.Size = oGraph.Size 
        oGraph_2.Position = oGraph.Position 
        oText.insertTextContent(oAnchor, oGraph_2, False) 
        oText.removeTextContent(oGraph) 
        EmbedLinkedGraphic_2 = True 
        
      ElseIf oGraph.supportsService(s2) Then 
      
        Dim oBitmaps 
        Dim sNewURL$ 
        Dim sName$ 
    
        sName$ = oGraph.LinkDisplayName 
        oBitmaps = oDoc.createInstance( "com.sun.star.drawing.BitmapTable" ) 
        If oBitMaps.hasByName(sName) Then 
          Print "Link display name " & sName & " already exists" 
          Exit Function 
        End If 
        'Print "Ready to insert (" & sName & ") with URL " & oGraph.GraphicURL 
        oBitmaps.insertByName( sName, oGraph.GraphicURL ) 
        'Print "inserted " & sName 
        'Inspect oBitMaps 
        'MsgBox Join(CHR$(10), oBitmaps.getElementNames()) 
        sNewURL$ = oBitmaps.getByName( sName ) 
        'Print "inserted URL " & sNewURL 
        oGraph.GraphicURL = sNewURL 
        EmbedLinkedGraphic_2 = True 
      End If 
    End Function 
    
    Function RecommendGraphSize(oGraph) 
      Dim oSize 
      Dim lMaxW As Double  ' Maximum width in 100th mm 
      Dim lMaxH As Double  ' Maximum height in 100th mm 
    
      lMaxW = 6.75 * 2540 ' 6.75 inches 
      lMaxH = 9.5 * 2540  ' 9.5 inches 
      
      If IsNull(oGraph) OR IsEmpty(oGraph) Then 
        Exit Function 
      End If 
      oSize = oGraph.Size100thMM 
      If oSize.Height = 0 OR oSize.Width = 0 Then 
        ' 2540 is 25.40 mm in an inch, but I need 100th mm. 
        ' There are 1440 twips in an inch 
        oSize.Height = oGraph.SizePixel.Height * 2540.0 * TwipsPerPixelY() / 1440 
        oSize.Width = oGraph.SizePixel.Width * 2540.0 * TwipsPerPixelX() / 1440 
      End If 
      If oSize.Height = 0 OR oSize.Width = 0 Then 
        'oSize.Height = 2540 
        'oSize.Width = 2540 
        Exit Function 
      End If 
      If oSize.Width > lMaxW Then 
        oSize.Height = oSize.Height * lMaxW / oSize.Width 
        oSize.Width = lMaxW 
      End If 
      If oSize.Height > lMaxH Then 
        oSize.Width = oSize.Width * lMaxH / oSize.Height 
        oSize.Height = lMaxH 
      End If 
      RecommendGraphSize = oSize 
    End Function
    
    

    external by yskflute  11  0  1  0

    play videos in linux mint and openoffice

    play videos in linux mint and openoffice: play_videos_in_linux_mint_and_openoffice.sh
    apt install libreoffice-avmedia-backend-gstreamer
    
    

    external by Full Phat Design  11  0  1  0

    Openoffice wrap column in string

    Openoffice wrap column in string: Openoffice wrap column in string
    =CONCATENATE("<ul>";D2;"</ul>")
    
    

    external by mikhail73  1068  0  3  0

    OpenOffice макрос для конвертации старой русской орфографии в новую

    OpenOffice макрос для конвертации старой русской орфографии в новую: FromOldOrtho4.vb
    REM  *****  BASIC  *****
    ' rev. 14 mikh
    ' Тестировался на LibreOffice 4.2 на более ранних версиях могут быть проблемы с регулярными выражениями.
    ' Этот макрос изначльно написан для MS Word http://simposium.ru/ru/node/7
    ' Участниками форума Инфа-Ресурс он был сконверирован для OpenOffice Writer http://community.i-rs.ru/index.php?topic=21745.0
    ' Начиная с версии 10 с пометкой mikh идут версии улучшеные мной.
    ' Начиная с версии 14 структура макроса переведена с цикла for на массив array, убраны лишние переменные и комментарии.
    ' Структура с массивом позволяет легко добовлять и удалять строки поиска и замены, но не позволяет комментировать каждую строку
    ' Тем кто хочет вникнуть в логику операций поиска и замен в макросе нужно читать комментарии в версии 12 https://gist.github.com/mikhail73/5300796
    '
    ' Для того чтобы сравнить работу разных версий макроса обработайте один и тот же текст разными версиями 
    ' и сохраните результаты в текстовых файлах, например результат1.txt и результат2.txt, 
    ' после чего эти файлы можно сравнивать при помощи программ winmerge или KDiff3.
    
    Sub FromOldOrtho4
    Dim oRD as Object
    oRD = thisComponent.createReplaceDescriptor
    oRD.SearchRegularExpression = True
    oRD.SearchCaseSensitive = True
    Repl = Array( _
      Array("\u0462", "Е"), _
      Array("\u0463", "е"), _
      Array("\u0406", "И"), _
      Array("\u0456", "и"), _
      Array("i([аиеояуюэы])", "и$1"), _
      Array("I([аиеояуюэы])", "И$1"), _
      Array("I([АИЕОЯУЮЭЫ])", "И$1"), _
      Array("\u0472", "Ф"), _
      Array("\u0473", "ф"), _
      Array("Ъ\>", ""), _
      Array("ъ\>", ""), _
      Array("аго\>", "ого"), _
      Array("АГО\>", "ОГО"), _
      Array("яго\>", "его"), _
      Array("ЯГО\>", "ЕГО"), _
      Array("(ш|щ|ч|ж)ого\>", "$1его"), _
      Array("(Ш|Щ|Ч|Ж)ОГО\>", "$1ЕГО"), _
      Array("(ш|щ|ч)агося\>", "$1егося"), _
      Array("(Ш|Щ|Ч)АГОСЯ\>", "$1ЕГОСЯ"), _
      Array("(ш|щ|к|нн|ж)ия\>", "$1ие"), _
      Array("(Ш|Щ|К|НН|Ж)ИЯ\>", "$1ИЕ"), _
      Array("(и|ы)яся\>", "$1еся"), _
      Array("(И|Ы)ЯСЯ\>", "$1ЕСЯ"), _
      Array("ыя\>", "ые"), _
      Array("ЫЯ\>", "ЫЕ"), _
      Array("(\W|^)(Не|не){0,1}(бе|в|во|и|ра|ро|чере|обе|Бе|В|Во|И|Ра|Ро|Чере|Обе)з([шкпфсхцчщт])", "$1$2$3с$4"), _
      Array("(\W|^)(НЕ){0,1}(БЕ|В|ВО|И|РА|РО|ЧЕРЕ|ОБЕ|)З([ШКПФСХЦЧЩТ])", "$1$2$3С$4"), _
      Array("(С|с)верхъ([^еёюя])", "$1верх$2"), _
      Array("(-|–)есть\>", " есть"), _
      Array("(-|–)ли\>", " ли"), _
      Array("(-|–)бы\>", " бы"), _
      Array("(-|–)же\>", " же"), _
      Array("(-|–)что\>", " что"), _
      Array("(-|–)будто\>", " будто"), _
      Array("\<(К|к)ое ([а-я])", "$1ое–$2"), _
      Array("\<КОЕ ([А-Я])", "КОЕ–$1"), _
      Array("\<(К|к)ой к", "$1ой–к"), _
      Array("\<КОЙ К", "КОЙ–К"), _
      Array("(А|а)ттак", "$1так"), _
      Array("АТТАК", "АТАК"), _
      Array("(Э|э)ксплоат", "$1ксплуат"), _
      Array("(Г|г)аллере", "$1алере"), _
      Array("(К|к)онтр(-|–)", "$1онтр"), _
      Array("(К|к)онтрадмирал", "$1онтр–адмирал"), _
      Array("(Л|л)ойяльн", "$1ояльн"), _
      Array("(И|и)тти", "$1дти"), _
      Array("(В|в)озрост", "$1озраст"), _
      Array("(О|о)ффициал", "$1фициал"), _
      Array("(Г|г)остинни", "$1остини"), _
      Array("(Р|р)асчит", "$1ассчит"), _
      Array("(А|а)ггрес", "$1грес"), _
      Array("(А|а)некс", "$1ннекс"), _
      Array("(Б|б)аталион", "$1атальон"), _
      Array("(Э|э)мисар", "$1миссар"), _
      Array("(Г|г)енералад", "$1енерал–ад"), _
      Array("(Г|г)енералот", "$1енерал–от"), _
      Array("(П|п)ривиллег", "$1ривилег"), _
      Array("(А|а)пплодисмент", "$1плодисмент"), _
      Array("(К|к)орридор", "$1оридор"), _
      Array("(Э|э)лексир", "$1ликсир"), _
      Array("(М|м)аиор", "$1айор"), _
      Array("\<иод(а|у|е|ом){0,1}\>", "йод$1"), _
      Array("\<Иод(а|у|е|ом){0,1}\>", "Йод$1"), _
      Array("\<ИОД(А|У|Е|ОМ){0,1}\>", "ЙОД$1"), _
      Array("\<(Е|е)я\>", "$1ё"), _
      Array("\<ЕЯ\>", "ЕЁ"), _
      Array("\<(Н|н)ея\>", "$1её"), _
      Array("\<НЕЯ\>", "НЕЁ"), _
      Array("\<(О|о)не\>", "$1ни"), _
      Array("\<ОНЕ\>", "ОНИ"), _
      Array("\<(О|о)дне\>", "$1дни"), _
      Array("\<ОДНЕ\>", "ОДНИ"), _
      Array("\<(О|о)днех\>", "$1дних"), _
      Array("\<ОДНЕХ\>", "ОДНИХ"), _
      Array("\<(О|о)днем\>", "$1дним"), _
      Array("\<ОДНЕМ\>", "ОДНИМ"), _
      Array("\<(О|о)днеми\>", "$1дними"), _
      Array("\<ОДНЕМИ\>", "ОДНИМИ"), _
      Array("\<(Н|н)а(-|–)днях\>", "$1а днях"), _
      Array("\<НА(-|–)ДНЯХ\>", "НА ДНЯХ"), _
      Array("\<(Б|б)ыть(-|–)может\>", "$1ыть может"), _
      Array("\<БЫТЬ(-|–)МОЖЕТ\>", "БЫТЬ МОЖЕТ"), _
      Array("\<(Д|д)о ныне\>", "$1оныне"), _
      Array("\<ДО НЫНЕ\>", "ДОНЫНЕ"), _
      Array("\<(В|в) ручную\>", "$1ручную"), _
      Array("\<В РУЧНУЮ\>", "ВРУЧНУЮ"), _
      Array("\<(П|п)о наслышке\>", "$1онаслышке"), _
      Array("\<ПО НАСЛЫШКЕ\>", "ПОНАСЛЫШКЕ"), _
      Array("\<(П|п)опрежнему\>", "$1о–прежнему"), _
      Array("\<ПОПРЕЖНЕМУ\>", "ПО–ПРЕЖНЕМУ"), _
      Array("\<(Н|н)ехватило\>", "$1е хватило"), _
      Array("\<НЕХВАТИЛО\>", "НЕ ХВАТИЛО"), _
      Array("\<(П|п)овидимому\>", "$1о–видимому"), _
      Array("\<ПОВИДИМОМУ\>", "ПО–ВИДИМОМУ"), _
      Array("\<(П|п)риэтом\>", "$1ри этом"), _
      Array("\<ПРИЭТОМ\>", "ПРИ ЭТОМ"), _
      Array("\<(Т|т).(-|–|—)е.\>", "$1. е."), _
      Array("\<Т.(-|–|—)Е.\>", "Т. Е."), _
      Array("\<(К|к)райния\>", "$1райние"), _
      Array("\<КРАЙНИЯ\>", "КРАЙНИЕ"), _
      Array("\<(В|в)етхия\>", "$1етхие"), _
      Array("\<ВЕТХИЯ\>", "ВЕТХИЕ"), _
      Array("\<(В|в)сякия\>", "$1сякие"), _
      Array("\<ВСЯКИЯ\>", "ВСЯКИЕ"), _
      Array("\<(В|в)еликия\>", "$1еликие"), _
      Array("\<ВЕЛИКИЯ\>", "ВЕЛИКИЕ"), _
      Array("\<(П|п)рочия\>", "$1рочие"), _
      Array("\<ПРОЧИЯ\>", "ПРОЧИЕ"), _
      Array("\<(В|в)нешния\>", "$1нешние"), _
      Array("\<ВНЕШНИЯ\>", "ВНЕШНИЕ"), _
      Array("\<(Н|н)икакия\>", "$1икакие"), _
      Array("\<НИКАКИЯ\>", "НИКАКИЕ"), _
      Array("\<(Б|б)лого\>", "$1лаго"), _
      Array("\<БЛОГО\>", "БЛАГО"), _
      Array("\<(Д|д)ревния\>", "$1ревние"), _
      Array("\<ДРЕВНИЯ\>", "ДРЕВНИЕ"), _
      Array("\<(С|с)редния\>", "$1редние"), _
      Array("\<СРЕДНИЯ\>", "СРЕДНИЕ"), _
      Array("\<(Д|д)ругия\>", "$1ругие"), _
      Array("\<ДРУГИЯ\>", "ДРУГИЕ"), _
      Array("\<(М|м)ногия\>", "$1ногие"), _
      Array("\<МНОГИЯ\>", "МНОГИЕ"), _
      Array("\<(П|п)оследния\>", "$1оследние"), _
      Array("\<ПОСЛЕДНИЯ\>", "ПОСЛЕДНИЕ"), _
      Array("\<(Д|д)альния\>", "$1альние"), _
      Array("\<ДАЛЬНИЯ\>", "ДАЛЬНИЕ"), _
      Array("\<Казакея\>", "Казакия"), _
      Array("\<Туркея\>", "Туркия"), _
      Array("\<Калмыкея\>", "Калмыкия"), _
      Array("\<Фракея\>", "Фракия"), _
      Array("\<Словакея\>", "Словакия"), _
      Array("\<Евдокея\>", "Евдокия") _
    )
    for each x in Repl()
      oRD.SearchString = x(0)
      oRD.ReplaceString = x(1)
      thisComponent.replaceAll(oRD)
    next
    End Sub
    
    

    external by 0x4a  243  3  3  0

    convert unix timestamp to regular date in Openoffice Calc #OO.o

    convert unix timestamp to regular date in Openoffice Calc #OO.o: OO.o-calc_unix-timestamp.txt
    =<Quellzelle>/86400+DATUMWERT("1970-01-01")
    
    

    external by atanasov  456  0  3  0

    OpenOffice support

    OpenOffice support: NumberToWords (Bulgarian)
    '=====================================================================================================================
    '
    '
    ' ОПИСАНИЕ
    '
    ' По подразбиране конвертира левове (в мъжки род), но може да се използва и за мярка в женски род (например метро
    ' единици) или среден род (например евро).
    '
    ' ИНСТАЛАЦИЯ
    '
    ' Стартирайте VBA в Excel с Alt+F11 и със щракване с десен бутон на мишката на VBAProject добавете нов празен
    ' модул (Module1). Копирайте тази функция (целия https://gist.github.com/4118581) в Module1 и затворете VBA
    ' редактора на код.
    '
    ' ИЗПОЛЗВАНЕ
    '
    ' В клетката, в която желаете да пише сумата словом можете да използвате това:
    '
    ' = ToWords(123)
    '
    ' или да подадете стойност на друга клетка (обща стойност на документа) така
    '
    ' = ToWord(A1)
    '
    ' което ще превърне числото от A1 в словом в текущата клетка.
    '
    ' Максимална стойност на първи параметър dblValue e 999 квадрилиона.
    '
    ' = ToWords(167.42) -> Сто шестдесет и седем лв. и 42 ст.
    ' = ToWords(-12341235) -> Минус дванадесет милиона триста четиридесет и една хиляди двеста
    ' тридесет и пет лв. и 0 ст.
    ' = ToWords(341.6, "МЕ|стотни", "F") -> Триста четиридесет и една МЕ и 60 стотни
    '
    '=====================================================================================================================
    Public Function num2words(ByVal dblValue As Double, Optional Measure As Variant, Optional Gender As String) As String
    ToWords = ""
    Dim vDigits As Variant
    Dim vGenderDigits As Variant
    Dim vValue As Variant
    Dim lIdx As Long
    Dim lDigit As Long
    '--- init digits (incl. gender ones)
    vDigits = Split("нула едно две три четири пет шест седем осем девет")
    vGenderDigits = vDigits
    Select Case Gender
    Case vbNullString, "M"
    vGenderDigits(1) = "един"
    vGenderDigits(2) = "два"
    Case "F"
    vGenderDigits(1) = "една"
    End Select
    '--- split input value on decimal point and pad w/ zeroes
    vValue = Mid(Format(0, "0.0"), 2, 1)
    vValue = Split(Format(Abs(dblValue), "0.00##"), vValue)
    vValue(0) = Right(String(18, "0") & vValue(0), 18)
    '--- loop input digits from right to left
    For lIdx = 1 To Len(vValue(0))
    If lIdx <= 3 Then
                lDigit = Mid(vValue(0), Len(vValue(0)) - lIdx + 1, 1)
            Else
                lDigit = Mid(vValue(0), Len(vValue(0)) - lIdx - 1, 3)
                lIdx = lIdx + 2
            End If
            If lDigit <> 0 Then
                '--- separate by space (first time prepend "и" too)
                If LenB(ToWords) <> 0 And (lIdx <> 2 Or lDigit <> 1) Then
                    If InStr(ToWords, " и ") = 0 Then
                        ToWords = " и " & ToWords
                    Else
                        ToWords = " " & ToWords
                    End If
                End If
                Select Case lIdx
                Case 1
                    ToWords = vGenderDigits(lDigit) & ToWords
                Case 2
                    If lDigit = 1 Then
                        '--- 11 to 19 special wordforms
                        If LenB(ToWords) <> 0 Then
                            ToWords = Replace(LTrim(ToWords), vGenderDigits(1), "еди")
                            ToWords = Replace(ToWords, vGenderDigits(2), "два") & "надесет"
                        Else
                            ToWords = "десет"
                        End If
                    Else
                        ToWords = IIf(lDigit = 2, "два", vDigits(lDigit)) & "десет" & ToWords
                    End If
                Case 3
                    '--- hundreds have special suffixes for 2 and 3
                    Select Case lDigit
                    Case 1
                        ToWords = "сто" & ToWords
                    Case 2, 3
                        ToWords = vDigits(lDigit) & "ста" & ToWords
                    Case Else
                        ToWords = vDigits(lDigit) & "стотин" & ToWords
                    End Select
                Case 6
                    '--- thousands are in feminine gender
                    Select Case lDigit
                    Case 1
                        ToWords = "хиляда" & ToWords
                    Case Else
                        ToWords = num2words(lDigit, vbNullString, Gender:="F") & " хиляди" & ToWords
                    End Select
                Case 9, 12, 15
                    '--- no special cases for bigger values
                    ToWords = num2words(lDigit, vbNullString) & " " & Split("милион милиард трилион квадрилион")((lIdx - 9) \ 3) _
                        & IIf(lDigit <> 1, "а", vbNullString) & ToWords
                End Select
            End If
        Next
        '--- handle zero and negative values
        If LenB(ToWords) = 0 Then
            ToWords = vDigits(0)
        ElseIf dblValue < 0 Then
            ToWords = "минус " & ToWords
        End If
        '--- apply measure (use vbNullString for none)
        If IsMissing(Measure) Then
            Measure = "лв.|ст."
        End If
        If LenB(Measure) <> 0 Then
            ToWords = ToWords & " " & Split(Measure, "|")(0) & " и " & Val(vValue(1))
            If InStr(Measure, "|") > 0 Then
                ToWords = ToWords & " " & Split(Measure, "|")(1)
            End If
            ToWords = UCase(Left$(ToWords, 1)) & Mid(ToWords, 2)
        End If
        num2words()=ToWords
    End Function
    
    
    • Public Snippets
    • Channels Snippets