bold text arabic only in Word using vb.net

Turki alhalwani 0 Reputation points
2023-05-22T08:13:40.3866667+00:00

bold text Arabic only in Word using vb.net

objDoc.Tables(1).Cell(7, 1).Select()
        objWordApp.Selection.Font.Bold = 1
        objDoc.Tables(1).Range.LanguageID = WdLanguageID.wdArabic
        objWordApp.Selection.TypeText("تركي")
        objWordApp.Selection.TypeParagraph()
        objWordApp.Selection.Font.Bold = False
        objWordApp.Selection.TypeText("alhalawani")
Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
743 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,658 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Osjaetor 475 Reputation points
    2023-06-05T17:36:23.42+00:00

    Hi Turki,

     Can you try with this snippet?
    
    Imports Microsoft.Office.Interop.Word
    
    Public Class WordArabic
    
        Private Sub CreateWordWithArabic()
            Dim wordApp As New Application()
            Dim wordDoc As Document = wordApp.Documents.Add()
            Dim arabicText As String = "تركي"
    		
            Dim arabicRange As Range = wordDoc.Range()
            arabicRange.Text = arabicText
            arabicRange.Font.Name = "Arial"
            arabicRange.Font.Size = 12
            arabicRange.Font.Bold = True
    
            ' Save and close the Word document
            wordDoc.SaveAs("C:\wordarabic.docx")
            wordDoc.Close()
            wordApp.Quit()
    
        End Sub
    	
    End Class
    

    Regards,

    0 comments No comments