Search code examples
c#crystal-reportswindows-10

Arabic number in crystal report


i can't display arabic number in crystal report, Arabic number apear in Report preview(design). Arabic number converted to english in runtime mandatory,I need to dispaly it in arabic not english. I try to change in windows language sitting not work note : this problem occur when using win 10 but when i use win 7 everythings are going well

        private void btnPrint_Click(object sender, EventArgs e)
    {
        Cursor.Current = Cursors.WaitCursor;
        BL.CLSReport report = new BL.CLSReport();

        /*
        var newCulture = CultureInfo.CreateSpecificCulture("ar-EG");
        Thread.CurrentThread.CurrentUICulture = newCulture;
        Thread.CurrentThread.CurrentCulture = newCulture;
        */
        Report.RptPersent persent = new Report.RptPersent();

        persent.SetDataSource(report.data_report(ColDate.Value,txtNu.Text,txtAdDay.Text).Tables["RptPersent"]);
        Report.FRMRpt frm = new Report.FRMRpt();
        frm.CRView.ReportSource = persent;
        frm.CRView.Refresh();
        frm.Show();
        Cursor.Current = Cursors.Default;
        DialogResult DR= MessageBox.Show("هل تريد تقليل المده المتبقيه بمقدار 1","هااااااام",MessageBoxButtons.OKCancel,MessageBoxIcon.Question);

        byte decr = Convert.ToByte(txtNu.Text);
        if (DR==DialogResult.OK &&  decr > 0)
        {
            Properties.Settings.Default.DayRemainder = --decr;
            txtNu.Text = decr.ToString();
            Properties.Settings.Default.Save();

        }
    }

enter image description here


Solution

  • from the report it self you can do a work around.... from the display string option add new formula to convert you numbers (ToText) and then replace number to Arabic numbers as follow :

    stringVar StrArb := ToText(your field);
    
    StrArb := Replace (StrArb ,"0" , "٠" );
    StrArb := Replace (StrArb ,"1" ,"١" );
    StrArb := Replace (StrArb ,"2" ,"٢" );
    StrArb := Replace (StrArb ,"3" ,"٣" );
    StrArb := Replace (StrArb ,"4" ,"٤" );
    StrArb := Replace (StrArb ,"5" ,"٥" );
    StrArb := Replace (StrArb ,"6" ,"٦" );
    StrArb := Replace (StrArb ,"7" ,"٧" );
    StrArb := Replace (StrArb ,"8" ,"٨" );
    StrArb := Replace (StrArb ,"9" ,"٩" );