Using Crystal Reports in VS2013

Source: Internet
Author: User
Tags log4net

Also encountered in the B/s system printing, printing format requirements are relatively high, print out the effect required on the tall. In the VS2013 of Microsoft's own report, it is difficult to achieve the effect of the application, the main problems are shown in:

1. You can not insert a good print template with Word, you install the module to do feel more trouble, printing can not achieve word printing effect, once the print template changes, the adjustment format is more troublesome.

2. The Print button is not displayed in Firefox or Google Chrome.

Want to try Crystal Report, helpless VS2013 has not integrated the report. You need to download the installation http://scn.sap.com/docs/DOC-7824 separately. You can download the appropriate Crystal Report plugin based on your vs version. But be sure to download EXE installable files instead of MSI installation files, or you can't find the Add Crystal Report item in vs. That is the description in the red box. Also to download a CLICKONCE32/64, the server deployment is required.

After installation, a familiar Crystal Reports is found in the new item of VS:

In the details "right-click"--"insert"--"OLE Object"-"created by file" To select the template to print. Drag the mouse to place.

In field Explorer, "parameter Fields"--"right"--"new parameters".

Drag and drop the parameters where you want to get the data dynamically.

Create a new Web form, drag and drop the Crystalreportviewer control, and set the related properties. If you do not need the left side of the group tree, you need to set toolpanelview= "None". This is different from the Crystal report that was used at the time in VS2008.

Set the field values dynamically in the page background code. As follows:

protected voidPage_Load (Objectsender, EventArgs e) {           if(!IsPostBack) {reportdocument Testreport=Newreportdocument (); //fetch the physical path to the report file               stringReportpath = Server.MapPath ("~/crystalreport1.rpt"); //load a report filetestreport.load (Reportpath);  This. Crystalreportviewer1.reportsource =Testreport; Parameterfields PFS=NewParameterfields (); Parameterfield PF=NewParameterfield (); Parameterdiscretevalue PV=NewParameterdiscretevalue (); Pf. Parameterfieldname="SQR"; Pv. Value="a dress and a widow"; Pf.               Currentvalues.add (PV); Pfs.                ADD (PF);  This. Crystalreportviewer1.parameterfieldinfo =PFS; }       } 

Run debug in VS, print template is missing, only the word "image", the result is as follows:

Right-click Picture Properties, see the path to the picture is: Http://localhost:/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_ 3ab921d0-cd7d-4fb9-a724-fd12c580b18d.png. The problem is that there is no crystalimagehandler.aspx in my project. Added blank crystalimagehandler.aspx page. Run again, OK. The effect is as follows:

Published in IIS. The following error occurs first:

Failed to load file or assembly "Log4net, version=1.2.10.0, culture=neutral, publickeytoken=692fbea5521e1304" or one of its dependencies. The system cannot find the file specified.

The problem is I didn't use it to log4net. According to the method of the Internet, C:\Windows\assembly\GAC_32\log4net\1.2.10.0__692fbea5521e1304\log4net.dll (different version log4net version may be different, You can use the DOS command in the C:\Windows\assembly folder to step through the dir command to find) copy out, placed in the post-deployment Program Bin folder. To refresh the page, the following error occurred:

failed to load file or assembly "log4net" or one of its dependencies. An attempt was made to load a program that is not properly formatted.

This error is familiar, the 64-bit operating system IIS application pool is not enabled for 32-bit applications, set to True. To refresh the page, the following error occurred:

Unsupported operation. Documents processed by the JRC engine cannot be opened in the C + + stack.

found that at the time of release vs will not publish RPT files, directly to the RPT copy. Refresh the page, OK.

Using Crystal Reports in VS2013

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.