See arabic number while export from crystal report to pdf
- Hi all,
This is the question that no body answer it in the internet
I build application in visual studio 2005 and i created a report in crystal report that integrated with the VS2005
i see the number in arabic in the web and also i see the number in arabic in the preview of the crystal report
but when i export the report to pdf , the number changed to english
i don't know why and no body know ho to do that in the internet
from three weeks i tried to solve this problem but without any advance
I hope any advanced programmer here can tell me the answer
thanks
Antworten
- Ok
I found the solution
I think im the first one who post the solution for this problem
I search before in all english and arabic threads but without a good solution
Some one tell me that you have to change the language setting from control panel...... but this not a good solution and not the solution at all
Some one tell me that you have to change the version for crystal report.... but this not the solution also
the solution is:
We have to build a function that change the character before we export the crystal report to pdf
and also first we have to know the character code of the arabic number, which are:
"0"
, (٠) "1", (١) "2", (٢) "3", (٣) "4", (٤) "5", (٥) "6", (٦) "7", (٧) "8", (٨) "9", (٩)
so now we can change the Text in the text box control by this statement:
ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"0", ChrW(1632)) and the complete function that i build for this problem is named ChangeToArabicNumber()
i make it public for the pages who have a master page, so the complete code is:
Private
Sub ChangeToArabicNumber() 'Eng.Ahmed Rashid Al-FarhanDim ArNumTextBox As TextBox For Each ctlMaster As Control In Page.Controls If TypeOf ctlMaster Is MasterPage Then
For Each ctlForm As Control In ctlMaster.Controls If TypeOf ctlForm Is HtmlForm Then
For Each ctlContent As Control In ctlForm.Controls If TypeOf ctlContent Is ContentPlaceHolder Then
For Each ctlChild As Control In ctlContent.Controls If TypeOf (ctlChild) Is TextBox Then
ArNumTextBox = ctlChild
' Case "0"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"0", ChrW(1632)) ' Case "1"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"1", ChrW(1633)) ' Case "2"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"2", ChrW(1634)) ' Case "3"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"3", ChrW(1635)) ' Case "4"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"4", ChrW(1636)) ' Case "5"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"5", ChrW(1637)) ' Case "6"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"6", ChrW(1638)) ' Case "7"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"7", ChrW(1639)) ' Case "8"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"8", ChrW(1640)) ' Case "9"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"9", ChrW(1641)) End IfNext
End If
Next
End If
Next
End If
Next
End Sub
So know every one can get the report in pdf with arabic number
thanks to all and best regards- Als Antwort markiertAhmedkiwi Sonntag, 20. Juli 2008 12:22
Alle Antworten
- Ok
I found the solution
I think im the first one who post the solution for this problem
I search before in all english and arabic threads but without a good solution
Some one tell me that you have to change the language setting from control panel...... but this not a good solution and not the solution at all
Some one tell me that you have to change the version for crystal report.... but this not the solution also
the solution is:
We have to build a function that change the character before we export the crystal report to pdf
and also first we have to know the character code of the arabic number, which are:
"0"
, (٠) "1", (١) "2", (٢) "3", (٣) "4", (٤) "5", (٥) "6", (٦) "7", (٧) "8", (٨) "9", (٩)
so now we can change the Text in the text box control by this statement:
ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"0", ChrW(1632)) and the complete function that i build for this problem is named ChangeToArabicNumber()
i make it public for the pages who have a master page, so the complete code is:
Private
Sub ChangeToArabicNumber() 'Eng.Ahmed Rashid Al-FarhanDim ArNumTextBox As TextBox For Each ctlMaster As Control In Page.Controls If TypeOf ctlMaster Is MasterPage Then
For Each ctlForm As Control In ctlMaster.Controls If TypeOf ctlForm Is HtmlForm Then
For Each ctlContent As Control In ctlForm.Controls If TypeOf ctlContent Is ContentPlaceHolder Then
For Each ctlChild As Control In ctlContent.Controls If TypeOf (ctlChild) Is TextBox Then
ArNumTextBox = ctlChild
' Case "0"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"0", ChrW(1632)) ' Case "1"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"1", ChrW(1633)) ' Case "2"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"2", ChrW(1634)) ' Case "3"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"3", ChrW(1635)) ' Case "4"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"4", ChrW(1636)) ' Case "5"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"5", ChrW(1637)) ' Case "6"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"6", ChrW(1638)) ' Case "7"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"7", ChrW(1639)) ' Case "8"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"8", ChrW(1640)) ' Case "9"ArNumTextBox.Text = ArNumTextBox.Text.Replace(
"9", ChrW(1641)) End IfNext
End If
Next
End If
Next
End If
Next
End Sub
So know every one can get the report in pdf with arabic number
thanks to all and best regards- Als Antwort markiertAhmedkiwi Sonntag, 20. Juli 2008 12:22
- Please Would you upload a sample projects that uses your code to convert numberals to arabic format before exporting to PDF, Also I wanna ask again if this code make numbers and date view as arabic format in PDF
Regards
Mohamed

