Take the 2-minute tour ×

I want to have my page numbers in LibreOffice Impress to be in Persian. Which means ۰۱۲۳۴۵۶۷۸۹ instead of 0123456789.

share|improve this question
Have you configured Persian as the default language for that application? Could you add a screenshoot? –  Lucio Apr 18 '13 at 21:51

1 Answer 1

up vote 6 down vote accepted

These settings work across all LibreOffice applications and documents, so you can make changes from any of the set of applications.

Changing the locale

You can set Persian as the default for all of your documents or for the current document only.

From the menu bar, Tools >> Options, then expand the Language Settings and click Languages

enter image description here

Change Locale to Farsi. (Note that this is independent of the setting for the user interface above.)

Change CTL to Default - Farsi. This will also automatically check Enabled for complex text layout (CTL) below. CTL handles right-to-left languages.

Check For the current document only according to your prefrence.

Changing the global numeral style

Click on Complex Text Layout on the left side of the dialog and change numerals to Hindi. (not shown in this screenshot)

Use Insert >> Page Number to show the Header/Footer dialog in order to add page numbers to your slides.

Setting numerals to Hindi in the Language Settings lets you use "Arabic" numbers without using an input method editor such as Ibus. In this context, of course, Arabic numerals are 1,2,3...

Is it possible to use Hindi numbers in the slide footer page number function without changing every number to Hindi?

Short answer: not through the GUI settings. Apart from the global number style setting, there does not appear to be any way to modify the function that inserts page numbers.

Interestingly enough, the footer lets you easily change the date to Persian. I believe the page numbers cannot be changed in a similar way because the page numbers appears to be drawn from functions to work with the printer.

The solution is to not use the built-in footer page numbering at all and instead insert your own text shape in the same area with the text set the way you want. For a small number of slides, this would not be too bad; but would not be feasible with more than a handful.

The solution to this problem is to use a LibreOffice Basic macro to insert the page numbers for you. For a short overview of LibreOffice macros and how to use them in your document, please see this answer.

Here is the macro code:

Sub AddPersianPageNumbers

    Dim Doc as Object
    Set Doc = ThisComponent

    'Get the collection of DrawingPages
    Dim DrwPages as Object
    Set DrwPages = Doc.getDrawPages()

    Dim DrwPg as Object
    Dim TxtShp as Object
    Dim TxtPoint as New com.sun.star.awt.Point

    Dim i as Long
    Dim k as Long

    Dim strNum as string
    Dim strI as string
    Dim idx as long
    Dim uni as string

    'Each slide has it's own Drawpage, so go through the collection
    For i = 0 to DrwPages.getCount() - 1

        'Get the Drawing Page and create a TextShape    
        Set DrwPg = DrwPages.getByIndex(i)
        Set TxtShp = Doc.createInstance("com.sun.star.drawing.TextShape")

        'Add it to the Drawing Page (must do first)

        TxtPoint.X = DrwPg.Width * 0.9
        TxtPoint.Y = DrwPg.Height * 0.9

        TxtShp.Position = TxtPoint  
        TxtShp.TextAutoGrowWidth = true
        TxtShp.TextAutoGrowHeight = true

        'Just changing the font is not enough since it will still show as Arabic
        'You can change the locale and ComplexText props for just this para
        'but I couldn't find a way to set the para to be seen as ComplexText
        'That would have been elegant, but instead just convert
        'the page number to a string converted from the Unicode code points 

        strI = Cstr(i + 1)

        for k = 1 to Len(strI)
            uni =  "&H66" & mid(strI, k, 1) 'Hindi numeral code points are ascii+660
            strNum = strNum & Chr(uni)
        next k

        strNum = ""

        TxtShp.CharFontName = "Lohit Hindi"

    Next i  

End Sub
share|improve this answer
I want the document to look the same on other computers as well! This way it doesn't. –  SeMeKh Apr 19 '13 at 12:10
Also, I just want the "page numbers" to be in Persian. Not "all the numbers used". –  SeMeKh Apr 19 '13 at 12:10
@SeMeKh Please see the updated answer –  chaskes Apr 24 '13 at 16:51

Your Answer


