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 ...
随机推荐
- java程序员面试宝典1
1.在java中字符串只以Unicode一种形式存在(不选择任何特定的编码,直接使用他们在字符集中的编号,这是统一的唯一的方法) 2.在java中,是指在JVM中,在内存中,在你的代码里声明的每个ch ...
- MVVM框架简单实现
众所周知当下是MVVM盛行的时代,从早期的Angular到现在的React和Vue,再从最初的三分天下到现在的两虎相争. 无疑不给我们的开发带来了一种前所未有的新体验,告别了操作DOM的思维,换上了数 ...
- net 网站过滤器 mvc webapi
WebApi过滤器1 public class TestController : ApiController { /// <summary> /// 获取用户信息 /// </sum ...
- java String int转换的不同方法
参考了网上某篇日志的内容,现摘录如下: String转int: 最常见:int i = Integer.parseInt("123"); 罕见:Integer i= Integer ...
- 转载:利用php数组函数进行函数式编程
因为一个BUG, 我在一个摇摇欲坠,几乎碰一下就会散架的项目中某一个角落中发现下面这样一段代码 这段程序与那个BUG有密切的关系. 我来回反复的捉摸这段代码, 发现这段代码实现了两个功能 第一个是在一 ...
- 条件随机场CRF介绍
链接:https://mp.weixin.qq.com/s/BEjj5zJG3QmxvQiqs8P4-w softmax CRF主要用于序列标注问题,可以简单理解为是给序列中的每一帧,既然是分类,很自 ...
- MVC-MVP-MVVM框架模式分析
MVC(Model-View-Controller) MVC 架构模式图(经典版) 注:实际上,Model和View永远不能相互通信,只能通过Controller传递:上图只是MVC模式的经典图. M ...
- ztree多种数据包装以及相关设置
首先来一个完整的ztree代码 html代码 <form id="addTreeDataFrm" method="post" class="fo ...
- tar命令--数据归档(二)
tar -cf all.tar *.jpg 这条命令是将所有.jpg的文件打成一个名为all.tar的包.-c是表示产生新的包,-f指定包的文件名. tar -rf all.tar *.gif 这条命 ...
- vuex中this.$store.dispatch和this.$store.commit的区别(都是调用vuex中的方法。一个异步一个同步)
dispatch:含有异步操作,例如向后台提交数据,写法: this.$store.dispatch('action方法名',值) commit:同步操作,写法:this.$store.commit( ...