WPF SAP水晶报表例子和打包Setup
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Viewer="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer" x:Class="TestCrystalReport.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid> <Viewer:CrystalReportsViewer x:Name="crystalReportsViewer" Margin="10"/> </Grid>
</Window> using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data; using CrystalDecisions.CrystalReports.Engine; namespace TestCrystalReport
{ //Crystal Report for Visaul Studio SDK download from http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_5.exe
//Runtime: CRRuntime_32bit_13_0_5
//http://downloads.businessobjects.com/akdlm/crnetruntime/clickonce/CRRuntime_64bit_13_0_5.msi
//http://downloads.businessobjects.com/akdlm/crnetruntime/clickonce/CRRuntime_32bit_13_0_5.msi
//when vs2010 build setup, this 2 runtime msi file need exists at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Crystal Reports for .NET Framework 4.0
//****importent if the app build with x86 then just need CRRuntime_32bit_13_0_5.msi*******
//and for vs2010 build setup can copy CRRuntime_32bit_13_0_5.msi and rename to CRRuntime_64bit_13_0_5.msi
//****************************************************************************************************************************************************
//can use vs2010 to build the setup package, va2012 just has InstallShield2015LimitedEdition and no microsoft setup.
//build setup with InstallShield refer:https://blog.csdn.net/caiandyong/article/details/50586648
//build setup use vs2010 refer article : https://blog.csdn.net/zhang_yling/article/details/88982585
//note : for this App.config need add below section if app use .NETFramework 4.5:
// <startup useLegacyV2RuntimeActivationPolicy="true">
// <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
// </startup> /// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Loaded += MainWindow_Loaded;
} string rptDBFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reports\\mm8report.mdb"); void MainWindow_Loaded(object sender, RoutedEventArgs e)
{ string rptTempFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reports\\mm8heatsheet3col.rpt");
showReport(rptTempFile); //crystalReportsViewer.
// CrystalReport
//CrystalDecisions.CrystalReports.ViewerObjectModel. // MyCrystalReport1 rpt = new MyCrystalReport1();
// rpt.SetDataSource(new PersonDAL().ListAll());
// crystalReportsViewer1.ViewerCore.ReportSource = rpt; // CrystalDecisions.CrystalReports.Engine.Database // MessageBox.Show(""+doc.HasSavedData);
/*-------------test set datasource-----------------------------------------------------------------------
DataTable tb=new DataTable() ;
tb.Columns.Add(new DataColumn ("id",DbType.Int32.GetType()));
tb.Columns.Add(new DataColumn("name",DbType.String.GetType() ));
DataRow r = tb.NewRow();
r[0] = 1;
r[0] = "1333333333";
tb.Rows.Add(r);
tb.BeginLoadData();
doc.SetDataSource(tb);
----------------------------------------------------------------------------------------------------------- */ /*-----------------------------test----------------------------------------------------------------------------
for (int i = 0; i < doc.Database.Tables.Count; i++)
{
//doc.Database.Tables[i].Location = aliasName;
//MessageBox.Show(doc.Database.Tables[i].Location);
//doc.Database.Tables[i].SetDataSource(tb);
}
--------------------------------------------------------------------------------------------------------------*/
// MessageBox.Show(doc.DataSourceConnections[0].DatabaseName); /*tes
using (AdventureWorksEntities db = new AdventureWorksEntities())
{
report.SetDataSource(from c in db.Contacts
select new
{
c.FirstName,
c.LastName,
c.EmailAddress,
c.Phone
});
} crystalReportsViewer1.ViewerCore.ReportSource = report;
*
*
' print dailog
PrintPreview pp = new PrintPreview();
pp.ShowDialog(); */ } void showReport(string rptTempFile) {
try
{
ReportDocument doc = new ReportDocument();
doc.Load(rptTempFile);
doc.DataSourceConnections[0].SetConnection(rptDBFile, "", "", "");
crystalReportsViewer.ViewerCore.ReportSource = doc;
crystalReportsViewer.ShowToggleSidePanelButton = false; }
catch(Exception ex) { MessageBox.Show( ex.Message ); } } }
}
以上是调用水晶报表的例子
下面是关于打包的问题,在身边注释里有写。
重要的一点是就是下载2个水晶报表的运行时 Runtime: CRRuntime_32bit_13_0_5,这个运行时如同.net framework的性质。
下载地址:http://downloads.businessobjects.com/akdlm/crnetruntime/clickonce/CRRuntime_64bit_13_0_5.msi
http://downloads.businessobjects.com/akdlm/crnetruntime/clickonce/CRRuntime_32bit_13_0_5.msi
版本号要和水晶报表开发包SDK的一致(Crystal Report for Visaul Studio SDK download from http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_5.exe);
参考: https://blog.csdn.net/zhang_yling/article/details/88982585
VS2017 VS2019 SETUP 参考:https://www.cnblogs.com/lxhbky/p/10695527.html
WPF SAP水晶报表例子和打包Setup的更多相关文章
- Vs2010中水晶报表引用及打包
原文:Vs2010中水晶报表引用及打包 转自:http://yunhaifeiwu.iteye.com/blog/1172283 Vs2010中水晶报表引用 在sap官网中下载支持vs 2010中的水 ...
- VB6 加载水晶报表例子
VB6 加载水晶报表例子 先按照水晶报表组件 Crystal Reports,Business Objects,现已被SAP收购. 再添加引用 'Library: CRAXDRT 'C:\Progra ...
- VS2010与水晶报表V13的打包集成小结
感谢孟子E章提供的技术咨询. 系统配置: Windows 7 + VS2010 , WinForm + DotNet4 + 水晶报表 这里说的打包集成,指的用VS2010的制作的安装包,在安装的时候可 ...
- (转)VS2010结合水晶报表做条码标签打印功能
本文转载自:http://blog.sina.com.cn/s/blog_552ca1400100y6dd.html 先来个功能效果图: 大家都知道VS2005和VS2008软件本身是包含水晶报表插件 ...
- 水晶报表在vs2010 WPF环境下的尝试
原文:水晶报表在vs2010 WPF环境下的尝试 由于VS2010没有集成水晶报表组件,尝试前必须先安装 水晶报表 for VS2010,若机器未安装的可点击这里>>>下载安装 新建 ...
- SAP B1:水晶报表中用Code128制作条型码的方法
一.在[文件系统]中新建一个[Fonts文件夹],然后添加[Code128.ttf]文件. 二.在水晶报表里的[字段资源管理器]的[公式字段]中新建一个公式字段.点击[使用编辑器]之后弹出[公式工作室 ...
- 水晶报表13.x(Crystal Reports for VS2010)的安装部署经验
这两天搞安装包真心坎坷,一个问题接一个问题,先是为了实现自定义动作现啃vbs,后面又是安装过程老是报错: 各种搜索.各种尝试,总算搞掂,积累了些经验,分享一下. 首先CR for VS2010的所有东 ...
- [转]VS2010中水晶报表安装应用及实例
基本分类如下:第一部分:VS2010简介VS2010是微软的提供的一套完整的开发环境,功能也是相当的大微软宣布了下一代开发工具和平台的正式名称,分别称为“Visual Studio Team Syst ...
- (转)VS.NET2010水晶报表安装部署[VS2010]
本文转载自:http://www.cnblogs.com/xiaofengfeng/p/3325793.html 欢迎C#高手加盟QQ群:9340166 水晶报表VS2010版IDE安装标准版SAP ...
随机推荐
- 最大熵与EM算法
一.熵.联合熵(相当于并集).条件熵.互信息 1.熵是什么? (0)信息量:信息的度量p(xi).信息量和概率成反比,熵是信息量的期望. X是一个随机变量,可能取值有很多个.熵是信息量的期望.熵反应的 ...
- Thymeleaf后台传值读取
/** * 测试用Controller * * @author * @date 2019-08-15 */@Controller@RequestMapping("/danyu/test& ...
- 为了实现动态加载而编写的自己的ClassLoader
Copy备用 之前客户要求在不重启应用的前提下实现动态增加服务及交易,在网上查了很长时间也没发现类似的技术,最后研究了一下ClassLoader.因为项目是与Spring,一开始我和同事尝试替换源码的 ...
- [CQOI2013]新Nim游戏(博弈论,线性基)
[CQOI2013]新Nim游戏 题目描述 传统的Nim游戏是这样的:有一些火柴堆,每堆都有若干根火柴(不同堆的火柴数量可以不同).两个游戏者轮流操作,每次可以选一个火柴堆拿走若干根火柴.可以只拿一根 ...
- 牛客OI周赛13-提高组 比赛总结
比赛情况 1h才写出T1 100pts + T2 50pts(都是简单dp可还行).然后就去颓废了.颓废完来康康T3的暴力,wow,T3咋这么难呢!?期望概率好像不太会了,退了吧qwq. 所以最后 1 ...
- 【优化】SPA项目的基础优化
开启gzip压缩功能 引入CDN 路由懒加载 某些第三方组件按需加载而不是全部加载 较小的图片资源用base64嵌入src中,减少http请求
- 用css编写三角和半圆形状样式
1.三角样式 htriangle-down { height:; border-left:11rpx solid transparent; border-right:11rpx solid trans ...
- MySQL数据表
创建数据表 CREATE TABLE IF NOT EXISTS ([列名column][类型type][约束可选]) 查看数据表结构 DESC <表名> 修改数据表结构 ALTER ...
- R语言-六大数据结构
R语言有六种基本的数据结构(或者说数据类型吧).根据数据的维度和同质/异质可分为5种数据类型,最后再介绍一种特殊的类型“因子”. 同质 异质 1维 原子向量 列表 2维 矩阵 数据框 n维 数组 ...
- 在postman中请求的接口有csrf怎么办
今天在写项目的时候,写了一个post接口,为了防止crsf攻击,config.defalut.js文件中加了如下代码: exports.security = { csrf: { ignoreJSON: ...