Click here to Skip to main content
Click here to Skip to main content

How to Export Crystal Report in Regional Language Marathi, Hindi, Arabic.

, 25 Mar 2014
Rate this:
Please Sign up or sign in to vote.
I am going to resolve Issue of Font Displaying Box or Junk While Exporting Crystal report.

Introduction

I am going to resolve Issue of Font Displaying Box or Junk While Exporting Crystal report which Is created In Regional Language Like Marathi, Hindi ,Arabic. Most Issue Is because of The font .

The Font Which We use while developing Report Should be there on Server

Where you are going to Deploy your application .

If font is not there then it will create Junk like Characters .

Tip: You Cannot use any font to develop Report you should use Unicode Font for it.

Main Step is install Font on Server or any Place Where you are Going to Deploy Application.

While export Crystal report in Language like English we do not get issue because

by Default that font is installed in your PC(Computer).

But While Developing Report In regional Language we face issues:

  • Having fonts but there are not unicode that will be issue for displaying junk Characters.
  • But will see report on your developing PC (Personal Computer) it look proper but will deploying on server it display junk.

What is Unicode Font ? Why to use them.

Unicode provides a unique number for every character,

  • no matter what the platform,
  • no matter what the program,
  • no matter what the language

This line are Reference from site :

http://www.unicode.org/standard/WhatIsUnicode.html

Here in this site you will see all details about Unicode font.

Here I am showing you steps how to Resolve this issue in few steps.

Follow Steps

  1. Create New Application
  2. Step File → New → Project
  3. In Installed Template Select Web → ASP.NET Web Application.
  4. Add Name to it.

    Here is Snapshots with Explanation for Creating New application.

  5. After creating Application Just add Webform and Name it .

  6. Add Crystal Report Viewer to Page to display report and Also adding Button to Export

    to Crystal report in to Pdf.

    Here I am providing code for of .aspx page.

    Tools used:

    • Button.
    • Crystal Report Viewer.

    <html xmlns="http://www.w3.org/1999/xhtml">

    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head runat="server">
    
    <title></title>
     
    </head>
    
    <body>
    
    <form id="form1" runat="server">
    
    <div style="text-align: center;">
    
    <asp:Button ID="Button1" runat="server" Width="150px" Height="50px" Text="Export to Pdf" OnClick="Button1_Click" />
    
    </div>
    
    <div style="text-align: center;">
    
    <asp:Button ID="Button1" runat="server" Text="Button" />
    
    </div>
    
    </form>
    
    </body>
    
    </html>
  7. Add CrystalReport
    • Selecting reporting tools from installed templates
    • After selecting you can see crystal report with visual C#
    • Just select it and name it.



    After this Just new Window will Popup for selection.

    • In popup you will find 3 option to develop it.
    • That Select Blank report.

  8. To Crystal-report I am just Binding Stored procedure.
    • I have just Created table with Name DOIUsertemp.
    • For storing charater of Unicode I have given datatype of it to Nvarchar.

    In Table I have Marathi Inserted Unicode Values to display on Report.

    [ One of Regional Language in India ]

    Data. Create Table.

    View of Table. [ This is Snapshot of Record in Table DOIUsertemp in Marathi.]

    View of Stored procedure

    [ Created Stored Procedure for get values from database and displaying on report ]

    [ This is Snapshot of crystal report with store procedure Fields.]

  9. In this step I am going Dragging Fields on Report from Stored procedure.
  10. After Dragging fields on report i am going to show you how to select font.

    Steps

    1. Select the Drag Field on Crystal-report .
    2. select Font From above Header which we want to use. (Regional Language Font and MustUnicode).
    3. For Marathi I am going to Select Mangal.
    4. You Can select your own Font according to your need.

    [ This is Snapshot while Selecting in Marathi Font.]

    [ This is Snapshot of Perview Crystal report in Marathi.]

  11. After that just save report.
  12. Now just We Need to write Code for Binding Report and Exporting Report .
  13. Binding Report on load.

    Here I am Providing Code for Binding Crystal Report on Load Event.

    protected void Button1_Click(object sender, EventArgs e)
    {
    SqlCommand cmd = new SqlCommand("Usp_GetUser", con); // calling for Exporting Records cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    DataTable datatable = new DataTable();
    da.Fill(datatable); // getting value according to imageID and fill dataset
    // creating object of crystal report 
    ReportDocument crystalReport = new ReportDocument(); 
    crystalReport.Load(Server.MapPath("~/CrystalReport1.rpt")); 
    
    // path of report
    crystalReport.SetDataSource(datatable); 
    
    // binding datatable 
    CrystalReportViewer1.ReportSource = crystalReport;
    
    crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "PersonDetails");

Here is Output for Marathi Data after exporting report with no junk Character.

For Hindi Language.

Same Process is required for Developing Crystal in Hindi .

Also Just Change the Font to Hindi while Creating Report its

On button click use same Code used for Marathi to exporting report.

Done. For Demo in table I have Inserted Hindi Record.

View of Table. [ This is Snapshot of Record in Table DOIUsertemp in Hindi.]


Selecting Hindi Font .

[ This is Snapshot while Selecting in Hindi Font.]

Final Out put for Hindi Data after Exporting.

For Arabic Language.

Same Process is required for Developing Crystal in Arabic .

Also Just Change the Font to Arabic while Creating Report its Done.

Main point you can install any other font of Arabic and develop but Font must be Unicode. For Demo in table I have Inserted Arabic Record.

View of Table. [ This is Snapshot of Record in Table DOIUsertemp in Arabic.]

Selecting Arabic Font

[ This is Snapshot while Selecting in Arabic Font.]

Final Out put for Arabic Data.



On button click use same Code used For Exporting Marathi Crystal Report.

Completed My Solution.

Programmer For Sharing Knowledge and Gaining Knowledge

Making People Life Easy

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

saineshwar
Software Developer
India India
Programmer For Sharing Knowledge and Gaining Knowledge
 
Making People Life Easy
Follow on   Google+   LinkedIn

Comments and Discussions

 
QuestionVery nice article... really helpful. Pinmemberlaxmanppatil25-Mar-14 19:26 
AnswerRe: Very nice article... really helpful. Pinmembersaineshwar20-Apr-14 18:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Mar 2014
Article Copyright 2014 by saineshwar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid