如何设置 LibreOffice 以使用波斯语/阿拉伯语-印度语/印地语页码?

sem*_*ekh 20 libreoffice rtl

我想让 LibreOffice Impress 中的页码使用波斯语。意思是 ??????????而不是 0123456789。

cha*_*kes 25

这些设置适用于所有 LibreOffice 应用程序和文档,因此您可以从任何一组应用程序进行更改。

更改语言环境

您可以将波斯语设置为所有文档或仅当前文档的默认值。

从菜单栏中,Tools >> Options,然后展开Language Settings并单击Languages

在此处输入图片说明

语言环境更改为波斯语。(请注意,这与上述用户界面的设置无关。)

CTL更改为默认-波斯语。这也将自动选中启用下面的复杂文本布局 (CTL)。CTL 处理从右到左的语言。

根据您的喜好检查当前文档

更改全局数字样式

单击对话框左侧的复杂文本布局并将数字更改为印地语。(此屏幕截图中未显示)

使用插入 >> 页码显示页眉/页脚对话框,以便向幻灯片添加页码。

在语言设置中将数字设置为印地语可让您使用“阿拉伯语”数字,而无需使用 Ibus 等输入法编辑器。在这种情况下,当然,阿拉伯语数字是1,2,3 ...

是否可以在幻灯片页脚页码功能中使用印地语数字而不将每个数字都更改为印地语?

简短回答:不是通过 GUI 设置。除了全局编号样式设置外,似乎没有任何方法可以修改插入页码的功能。

有趣的是,页脚可让您轻松地将日期更改为波斯语。我相信页码不能以类似的方式更改,因为页码似乎是从与打印机一起使用的函数中提取的。

解决方案是根本不使用内置的页脚页码,而是在同一区域插入您自己的文本形状,并按照您想要的方式设置文本。对于少数幻灯片,这不会太糟糕;但只有少数是不可行的。

问题的解决方案是使用 LibreOffice Basic 宏为您插入页码。有关 LibreOffice 宏的简短概述以及如何在文档中使用它们,请参阅此答案

这是宏代码:

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)
        DrwPg.Add(TxtShp)   

        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

        TxtShp.SetString(strNum)
        strNum = ""

        TxtShp.CharFontName = "Lohit Hindi"

    Next i  


End Sub
Run Code Online (Sandbox Code Playgroud)