使用Gird++打印出现“Retrieving the COM class factory for component with CLSID”的解决办法
我们的接口需要返回一个gird++生成PDF文件的二进制数据,在本地测试都很好,发布到服务器上一直出现“Retrieving the COM class factory for component with CLSID”问题。
最后终于找到问题的解决方法:把程序池里的Enable 32-Bit Applications 设置为True
(ps: 服务器上要安装Grid++的客户端)

另外 附上代码
public struct MatchFieldPairType
{
public IGRField grField;
public int MatchColumnIndex;
}
public class PrintHelper
{
// 将 DataTable 的数据转储到 Grid++Report 的数据集中
public static void FillRecordToReport(IGridppReport Report, DataTable dt)
{
MatchFieldPairType[] MatchFieldPairs = new MatchFieldPairType[Math.Min(Report.DetailGrid.Recordset.Fields.Count, dt.Columns.Count)]; //根据字段名称与列名称进行匹配,建立DataReader字段与Grid++Report记录集的字段之间的对应关系
int MatchFieldCount = ;
for (int i = ; i < dt.Columns.Count; ++i)
{
foreach (IGRField fld in Report.DetailGrid.Recordset.Fields)
{
if (String.Compare(fld.Name, dt.Columns[i].ColumnName, true) == )
{
MatchFieldPairs[MatchFieldCount].grField = fld;
MatchFieldPairs[MatchFieldCount].MatchColumnIndex = i;
++MatchFieldCount;
break;
}
}
} // 将 DataTable 中的每一条记录转储到 Grid++Report 的数据集中去
Report.PrepareRecordset();
foreach (DataRow dr in dt.Rows)
{
//Report.PrepareRecordset();
Report.DetailGrid.Recordset.Append(); for (int i = ; i < MatchFieldCount; ++i)
{
if (!dr.IsNull(MatchFieldPairs[i].MatchColumnIndex))
MatchFieldPairs[i].grField.Value = dr[MatchFieldPairs[i].MatchColumnIndex];
}
Report.DetailGrid.Recordset.Post();
}
}
}
var report = new GridppReport();
report.LoadFromFile(Server.MapPath("~/eExpressReportbulk.grf"));
PrintHelper.FillRecordToReport(report, printDt);
string fileName = ConfigurationSettings.AppSettings["pdfPath"] + shipmentNumber + ".pdf";
//直接调用ExportDirect方法执行导出任务
report.ExportDirect(GRExportType.gretPDF, fileName, false, false); FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate);
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, , Convert.ToInt32(stream.Length));
stream.Close();
附上Grid++破解dll: 下载
使用Gird++打印出现“Retrieving the COM class factory for component with CLSID”的解决办法的更多相关文章
- Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} fai ...
- 【Excel】Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}:
[Excel]Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-0000000000 ...
- C# - (0x80040154): Retrieving the COM class factory for component with CLSID {877AA945-1CB2-411C-ACD7-C70B1F9E2E32} failed
1. Exeption Error: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM clas ...
- Retrieving the COM class factory for component with CLSID XX failed due to the following error: 80070005 拒绝访问。
环境及异常信息说明 环境说明: Win2008 R2 企业版 x64 .IIS 7.0 功能说明:服务端操作Excel,(上传Excel到服务器,并在服务器端读取Excel中的数据) 异常信息:Ret ...
- Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 拒绝访问
异常信息:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046 ...
- C# Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005
环境说明: Win2008 R2(中文版) x64 .IIS 7.0 功能说明:上传Excel到服务器,并在服务器端读取Excel中的数据: 异常信息:Retrieving the COM class ...
- 异常:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
异常:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} ...
- C#-Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
异常信息如下 捕获到执行这句时异常: Excel.Application ep = new Excel.ApplicationClass(); Retrieving the COM class fac ...
- Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 拒绝访问。
这几天在写一个导出word的功能,使用 Microsoft.Vbe.Interop.dll和Office.dll 在本地都可以正常运行,但是上传到服务器后就报错,如下图: 对于此问题,也在网上查了一些 ...
随机推荐
- QT参考录
源码参考: #include "CServerManager.h" CServerManager* CServerManager::m_pInstance = NULL; CSer ...
- 修改MYSQL最大连接数的2种方法
mysql默认最大连接数是100,增加加默认MYSQL连接数的方法有两个 方法一:进入MYSQL安装目录 打开MYSQL配置文件 my.ini(windows) 或 my.cnf(linux环境)查找 ...
- arclist标签和list标签区别
很多站长朋友在刚入门织梦的时候对织梦的标签存在很多的困惑,关于arclist标签和list标签,甚至不知道啥时候用arclist,啥时用list标签.arclist 为自由列表,全局模板中都生效,一般 ...
- MySQL和MsSQL实时自动同步---SyncNavigator 数据库同步软件
需要MySQL数据库支持的狐友们有福了,MySQL和MsSQL实时自动同步---SyncNavigator 数据库同步软件 使用SyncNavigator轻松实现数据库异地同步.断点续传.异构同步 ...
- 不在界面上用控件 动态创建idhttp,IdAntiFreeze来用
不在界面上用控件 动态创建idhttp,IdAntiFreeze来用 var IdHTTP: Tidhttp; IdAntiFreeze: TidAntiFreeze; begin IdAntiFre ...
- Properties配置文件
package file; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; ...
- JSP与Servlet之间传值
Jsp与Servlet之间的传值有两种,一种是Jsp传值给Sevlet,另一种是Servlet传值给Jsp:使用request.response对象完成传值,具体实现如下: 1.JSP传值给Servl ...
- 转:Java反射教程
原文来自于:http://www.importnew.com/9078.html 什么是反射?反射有什么用处? 1. 什么是反射? “反射(Reflection)能够让运行于JVM中的程序检测和修改运 ...
- Top 100 English Verbs
accept allow ask believe borrow break bring buy can/be able cancel change clean comb complain cough ...
- B450配置
电脑型号 联想 B450 笔记本电脑 (扫描时间:2015?5?7?操作系统 Windows 7 旗舰版 32位 SP1 ( DirectX 11 ) 处理器 英特尔 酷睿2 双核 T9800 @ ...