Last active
November 27, 2017 06:44
-
-
Save weeix/67e4670e6973822d4cdd774c35589f2b to your computer and use it in GitHub Desktop.
Macro ชุดนี้มีไว้แก้ไขเลขอารบิก (0-9) ในเอกสารทั้งหมดให้เป็นเลขไทย (๐-๙) เหมาะกับเอกสารที่จัดทำโดยใช้ฟอนต์ TH SarabanIT๙ หรือ TH NiramitIT๙ และต้องการเปลี่ยนกลับมาใช้ฟอนต์มาตรฐาน (ทดสอบกับ LibreOffice 5.4.3.2 แล้ว)
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 Main | |
Dim arabicNumerals(10) As String | |
Dim thaiNumerals(10) As String | |
Dim n As Long | |
Dim oDocument As Object | |
Dim oReplace As Object | |
arabicNumerals() = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") | |
thaiNumerals() = Array("๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙") | |
oDocument = ThisComponent | |
oReplace = oDocument.createReplaceDescriptor | |
For n = lbound(arabicNumerals()) To ubound(arabicNumerals()) | |
oReplace.SearchString = arabicNumerals(n) | |
oReplace.ReplaceString = thaiNumerals(n) | |
oDocument.replaceAll(oReplace) | |
Next n | |
End Sub |
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 Main | |
Dim arabicNumerals(10) As String | |
Dim thaiNumerals(10) As String | |
Dim n As Long | |
Dim oDocument As Object | |
Dim oReplace As Object | |
arabicNumerals() = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") | |
thaiNumerals() = Array("๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙") | |
oDocument = ThisComponent | |
oReplace = oDocument.createReplaceDescriptor | |
For n = lbound(thaiNumerals()) To ubound(thaiNumerals()) | |
oReplace.SearchString = thaiNumerals(n) | |
oReplace.ReplaceString = arabicNumerals(n) | |
oDocument.replaceAll(oReplace) | |
Next n | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment