使用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 在本地都可以正常运行,但是上传到服务器后就报错,如下图: 对于此问题,也在网上查了一些 ...
随机推荐
- 1.Tomcat配置
1.启动 解压缩安装包后,点击startup.bat,保持控制台窗口开启 浏览器中输入http://localhost:8080 后看到启动界面则表示启动成功 点击shutdown.bat则关闭Tom ...
- JavaScript escape() 函数
JavaScript escape() 函数 JavaScript 全局对象 定义和用法 escape() 函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串. 语法 escape(str ...
- php 操作xml文件
读取xml:$doc=new DOMDocument(); $doc->load('news.xml'); $news=$doc->getElementsByTagName("n ...
- Unity3D添加Admob广告
重要提示: 貌似play2014年8月之后不会再支持admob的SDK方式的广告了.github上已经有了 Unity AdMob (Google Play Services) ...
- 转:VC中WORD,DWORD,unsigned long,unsigned short的区别(转)
typedef unsigned long DWORD;typedef int BOOL;typedef unsigned char BYTE; ...
- 方便john破解linux密码批处理
Title:方便john破解linux密码批处理 -- 2011-11-23 17:31 自定义文件HASH名和字典名批处理(单一文件): @echo offcolor 0asetlocal enab ...
- Nmap Snote
Title:Nmap Snote --2011-11-15 21:28 用Nmap上瘾了,怕以后忘记,也就记一下. Nmap -v -sS -n -p1-65535 IP Nmap -v -sS -p ...
- Large sum
聪明的办法是想:求前10位,那只要前8位加起来,进2位就OK. 本的办法,就是真的加起来,截前面10位.如我. numList = str.split() sum = 0 for i in range ...
- Largest product in a grid
这个比前面的要复杂点,但找对了规律,还是可以的. 我逻辑思维不强,只好画图来数数列的下标了. 分四次计算,存入最大值. 左右一次,上下一次,左斜一次,右斜一次. In the 2020 grid be ...
- C51与汇编混合编程详解
C51和汇编混合编程(1)-C语言中嵌入汇编 1.在 C文件中要嵌入汇编代码片以如下方式加入汇编代码: #pragma ASM ;Assembler Code Here #pragma ENDASM ...