RSS

Print Crystal Report with Khmer Unicode in C# Application

07 Oct

This step use to Microsoft Visual Studio.NET 2005, and it’s rendered well with Khmer Unicode.

  1. Copy usp10.dll into Business Object Location (ex: C:\Program Files\Common Files\Business Objects\2.7\Bin\)
  2. Go to Visual Studio.NET 2005 with Design View, and right click on ToolBox Panel -> Select Choose Items. After that    Select COM Components Tab -> Click on Browse Button and Select on crviewer.dll in Business Object Location
  3. Add Reference Project, You go into Business Object Location select craxddrt.dll .
  4. Create a new Crystal Report
  5. Go to Coding View and code like below:

Preview Crystal Report in Crystal ActiveX Report Viewer

CRAXDDRT.Application crxApp = new CRAXDDRT.Application();
CRAXDDRT.Report crxReport = new CRAXDDRT.Report();
crxReport = crxApp.OpenReport(Application.StartupPath
 + "/KhmerUnicodeTest.rpt", null);
CRAXDDRT.DatabaseTable crxdt = crxReport.Database.Tables[1];
crxdt.SetLogOnInfo("[Server Name]", "[Database Name]", "[User Name]", "[Password]");
crxReport.ParameterFields.GetItemByName("[ParameterName]", "[SubReportName]").AddCurrentValue(val);
crxReport.OpenSubreport("[SubReportName]").ParameterFields.GetItemByName("[ParameterName]", "").AddCurrentValue(val);
this.axCrystalActiveXReportViewer1.ReportSource=crxReport;
this.axCrystalActiveXReportViewer1.ViewReport();

Auto Print with Default Printer

CRAXDDRT.Application crxApp = new CRAXDDRT.Application();
CRAXDDRT.Report crxReport = new CRAXDDRT.Report();
crxReport = crxApp.OpenReport(Application.StartupPath
 + "/KhmerUnicodeTest.rpt", null);
foreach (CRAXDDRT.DatabaseTable crxdt in crxReport.Database.Tables)
{
 crxdt.SetLogOnInfo("[Server Name]", "[Database Name]", "[User Name]", "[Password]");
}
crxReport.SelectPrinter("", "<Printer Name>", "");
crxReport.PrintOut(false, 1, true, 1, 200);

How to show “Printer Dialog”

CRAXDDRT.Application crxApp = new CRAXDDRT.Application();
CRAXDDRT.Report crxReport = new CRAXDDRT.Report();
crxReport = crxApp.OpenReport(Application.StartupPath
 + "/KhmerUnicodeTest.rpt", null);
foreach (CRAXDDRT.DatabaseTable crxdt in crxReport.Database.Tables)
{
 crxdt.SetLogOnInfo("[Server Name]", "[Database Name]", "[User Name]", "[Password]");
}

PrintDialog diag = new PrintDialog();
if (diag.ShowDialog() ==  DialogResult.OK)
{
   crxReport.SelectPrinter("", diag.PrinterSettings.PrinterName, "");
   crxReport.PrintOut(false, 1, true, 1, 200);
}

Notation: If you use Visual Studio 2008 for Project Development, you need Merge Module to install all client. It’s called CRRedist2008_x86.zip (Crystal Report Basic 2008 Run Time Package)

Reference Code from http://computer-experience.blogspot.com/2008/12/khmer-unicode-with-crystal-report-in-c.html

Advertisements
 
15 Comments

Posted by on October 7, 2009 in Window Application

 

15 responses to “Print Crystal Report with Khmer Unicode in C# Application

  1. chaky

    July 27, 2010 at 3:30 PM

    Thank you.

     
  2. Savada Sin

    February 21, 2011 at 8:07 PM

    That’s cool! I having a problem with directly print out. Thanks for your sharing!

     
  3. traiter une fissure anale

    August 26, 2014 at 12:30 PM

    What’s up mates, how is the whole thing, and what you desire to say concerning this article,
    in my view its really amazing designed for me.

     
  4. news

    September 7, 2014 at 8:00 AM

    The production, in tthe eighteenth century that stressed on strong emotions simon and garfunkle such as As
    You Like It.

     
  5. car rental rajasthan

    October 7, 2014 at 8:10 AM

    The manual can be printed out too should you choose to read it away from your computer.

    A recent study done by The Journal of Veterinary Behavior
    involved two training schools, one that used the old school type of forceful training, while one used
    a force-free method of training. Educating your dog could help save his
    or her life one day.

     
  6. putlocker

    October 14, 2014 at 9:24 AM

    Hello, i feel that i noticed you visited
    my website tthus i came to return the desire?.I’m attempting to to find issues
    to improve my web site!I guesss itss ok to use a few of your ideas!!

     
  7. vireak

    December 24, 2014 at 4:27 PM

    I tried to compile a setup file for the software. However it does not work for the client pc that we setup. I did install Crystal Report Basic 2008 Run Time Package, but still not work.
    Please help

     
  8. Soungeng Hy

    March 31, 2016 at 1:43 PM

    i got an error at this line:
    crxReport.SelectPrinter(“”, “”, “”);
    it alerts message that: “Attempted to divide by zero”

     
    • sochinda

      March 31, 2016 at 3:51 PM

      Hello Soungeng Hy,

      what’s Windows version you use?

       
      • Soungeng Hy

        April 5, 2016 at 4:02 PM

        Hi, thank for reply. The previous error i have fixed(it’s because I set printer to No printer, after i choose one of existing it work). I used window 7 64 bit

         
  9. Soungeng Hy

    April 5, 2016 at 3:51 PM

    Hi, thank for reply. The previous error i have fixed(it’s because I set printer to No printer, after i choose one of existing it work).

    Now i have other problem, in toolbox – reporting section it not show axCrystalActiveXReportViewer control, even I add it again from COM Component.

    Could you tell me some tip to fix the problem?
    Thanks in advance,
    Sou Ngeng

     
  10. Soungeng Hy

    April 5, 2016 at 4:06 PM

    i forget to add message error:
    Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

     
  11. Soungeng Hy

    April 8, 2016 at 11:43 AM

    i try reinstall visual studio 2008, then it work.

    Now I have other error, I connect crystal report on other computer(server) and it keep asking for username/password to connect to database. I use ODBC connection i have set username/password already both computer client and server(store database and report).
    Please help! Thanks in advance

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: