Does anyone has got working example of Crystal Report Viewer or MS Reporting Services Viewer?

0
0

Would be nice if separate extension projects created by WiseJ for Crystal Report viewer and MS Reporting Services as these are used quite heavily in database projects?

  • You must to post comments
0
0

Hi Nicky

I cant upload a sample here…

This is a link to a complete Sample that is similar to what I use (14Mb – Size is due to inclusion of Crystal Report Viewer javascript & activeX):

https://www.klevaworx.com/CrystalReportSample/CrystalReportSample.zip

Regards

Kevin

 

  • nicky suwandi
    Thanks Kevin Caine, i had success implement it crystall report using aspnetpanel.
  • You must to post comments
1
0

I am using the CR Viewer with all my WiseJ apps, and this method works on any Tablet we have used so far. I first populate an XML file on the server with the relevant data (that matches the dataset and rpt file). Then I send the xml file and the rpt file to a SEPERATE asp page (which I call from WiseJ) passing the location of the XML file and the rpt file (GET parameters as part of the URL). See below for various files… (oh, and to save headache, I copy the relevant CR files into a subdirectory on the webserver as well – Had issues with older apps using different versions of CR). Hope these samples help, you will obviously tweak to your own needs.

ReportViewer.asp:
<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”report.aspx.cs” Inherits=”xxxx” %>
<%@ Register assembly=”CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304″ namespace=”CrystalDecisions.Web” tagprefix=”CR” %>
<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Report Display</title>
</head>
<body>
<form id=”report” runat=”server”>
<div>
</div>
<CR:CrystalReportViewer ID=”crystalReportViewer” runat=”server” AutoDataBind=”true” />
</form>
</body>
</html>

ReportViewer.asp.cs:
using System;
using CrystalDecisions.CrystalReports.Engine;
using xxxx;

namespace xxxxx
public partial class report : System.Web.UI.Page {
ReportDocument viewerSource = null;

protected void Page_Load(object sender, EventArgs e)  {

string qsXmlFilename = Request.QueryString[“xfn”];
string qsViewerSource = Request.QueryString[“vs”];
Type t = Type.GetType(qsViewerSource);
viewerSource = (ReportDocument)Activator.CreateInstance(t);

xxxx.printSetViewer(viewerSource, qsXmlFilename); // This sub you will have to create to populate – sample provided below

crystalReportViewer.ReportSource = viewerSource;
crystalReportViewer.DisplayStatusbar = false;
crystalReportViewer.DisplayToolbar = true;
crystalReportViewer.EnableDrillDown = false;
crystalReportViewer.EnableDatabaseLogonPrompt = false;
crystalReportViewer.EnableParameterPrompt = false;
crystalReportViewer.EnableToolTips = false;
crystalReportViewer.HasCrystalLogo = false;
crystalReportViewer.HasDrilldownTabs = false;
crystalReportViewer.HasDrillUpButton = false;
crystalReportViewer.HasPageNavigationButtons = true;
crystalReportViewer.HasToggleGroupTreeButton = false;
crystalReportViewer.HasToggleParameterPanelButton = false;
crystalReportViewer.PrintMode = CrystalDecisions.Web.PrintMode.Pdf;
crystalReportViewer.SeparatePages = false;
crystalReportViewer.ShowAllPageIds = false;
crystalReportViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
}

Web.config additions:
<configuration>
<configSections>
<sectionGroup name=”businessObjects”>
<sectionGroup name=”crystalReports”>
<section name=”rptBuildProvider” type=”CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null” />
<section name=”crystalReportViewer” type=”System.Configuration.NameValueSectionHandler” />
</sectionGroup>
</sectionGroup>
</configSections>
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource=”true” />
</rptBuildProvider>
<crystalReportViewer>
<add key=”ResourceUri” value=”/crystalreportviewers” /> <!– Set your path to the CR folder on your server –>
</crystalReportViewer>
</crystalReports>
</businessObjects>

Sample of Function:
public static void printSetViewer(ReportDocument objReport, string tmpFile)  {
DataSet ds = new DataSet();
ds.ReadXml(tmpFile);
objReport.Load(objReport.FileName.ToString());
objReport.SetDatabaseLogon(“”, “”, tmpFile, ds.DataSetName.ToString());
objReport.SetDataSource(ds);

ConnectionInfo crConnInfo = new ConnectionInfo();
crConnInfo.ServerName = tmpFile;
crConnInfo.DatabaseName = ds.DataSetName.ToString();
crConnInfo.UserID = “”;
crConnInfo.Password = “”;
crConnInfo.Type = ConnectionInfoType.MetaData;

TableLogOnInfo tblTempLogonInfo = new TableLogOnInfo();
foreach (Table tbl in objReport.Database.Tables)  { // CR hates it if you don’t assign login info to Tables in your Dataset
tblTempLogonInfo = tbl.LogOnInfo;
tblTempLogonInfo.ConnectionInfo = crConnInfo;
tblTempLogonInfo.TableName = tbl.Name;
tblTempLogonInfo.ReportName = objReport.Name;
tbl.ApplyLogOnInfo(tblTempLogonInfo);
tbl.Location = tbl.Name;
tbl.SetDataSource(ds.Tables[tbl.ToString()]);
}
}

  • nicky suwandi
    Dear Kevin Caine Can your give complete example, i try to using your method, but didn’t success. I have searching how to implement crystall report ini wisej for 3 day, i got nothing working example. Thanks Regards Nicky
  • Kevin Caine
    I have some important customer work to sort out first. Will post a VS Solution in a few days when I have a gap. Have already done most, just need to do a form and then will be able to upload or refer to a zip.
  • Kevin Caine
    Hi Nicky I cant upload a sample here… This is a link to a complete Sample that is similar to what I use (14Mb – Size is due to inclusion of Crystal Report Viewer javascript & activeX): https://www.klevaworx.com/CrystalReportSample/CrystalReportSample.zip Regards Kevin
  • You must to post comments
0
0

can the PDF viewer bar be visible when on a mobile device? Reason being we would like to print the PDF from iPhone / iPad.

  • You must to post comments
0
0

You need to use the PdfViewer. The CR viewer for winforms cannot in the browser. In alternative you can use the CR ASP.NET viewer. I find the PdfViewer to be much better than the ASP.NET viewer.

This is all you need:

 var report = new ReportDocument();
 report.FileName = Application.MapPath("CrystalReport1.rpt");
 this.pdfViewer1.PdfStream = report.ExportToStream(ExportFormatType.PortableDocFormat);

 

Attachment
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.