使用Gird++打印出现“Retrieving the COM class factory for component with CLSID”的解决办法

时间:2022-09-22 17:17:05

我们的接口需要返回一个gird++生成PDF文件的二进制数据,在本地测试都很好,发布到服务器上一直出现“Retrieving the COM class factory for component with CLSID”问题。

最后终于找到问题的解决方法:把程序池里的Enable 32-Bit Applications 设置为True

(ps: 服务器上要安装Grid++的客户端)

使用Gird++打印出现“Retrieving the COM class factory for component with CLSID”的解决办法

另外 附上代码

    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”的解决办法的更多相关文章

  1. Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub; failed due to the following error&colon; 80070005&period;

    Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} fai ...

  2. 【Excel】Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub;&colon;

    [Excel]Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-0000000000 ...

  3. C&num; - &lpar;0x80040154&rpar;&colon; Retrieving the COM class factory for component with CLSID &lbrace;877AA945-1CB2-411C-ACD7-C70B1F9E2E32&rcub; failed

    1. Exeption Error: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM clas ...

  4. Retrieving the COM class factory for component with CLSID XX failed due to the following error&colon; 80070005 拒绝访问。

    环境及异常信息说明 环境说明: Win2008 R2 企业版 x64 .IIS 7.0 功能说明:服务端操作Excel,(上传Excel到服务器,并在服务器端读取Excel中的数据) 异常信息:Ret ...

  5. Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub; failed due to the following error&colon; 80070005 拒绝访问

    异常信息:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046 ...

  6. C&num; Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub; failed due to the following error&colon; 80070005

    环境说明: Win2008 R2(中文版) x64 .IIS 7.0 功能说明:上传Excel到服务器,并在服务器端读取Excel中的数据: 异常信息:Retrieving the COM class ...

  7. 异常:Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub; failed due to the following error&colon; 80070005&period;

    异常:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} ...

  8. C&num;-Retrieving the COM class factory for component with CLSID &lbrace;00024500-0000-0000-C000-000000000046&rcub;

    异常信息如下 捕获到执行这句时异常: Excel.Application ep = new Excel.ApplicationClass(); Retrieving the COM class fac ...

  9. Retrieving the COM class factory for component with CLSID &lbrace;000209FF-0000-0000-C000-000000000046&rcub; failed due to the following error&colon; 80070005 拒绝访问。

    这几天在写一个导出word的功能,使用 Microsoft.Vbe.Interop.dll和Office.dll 在本地都可以正常运行,但是上传到服务器后就报错,如下图: 对于此问题,也在网上查了一些 ...

随机推荐

  1. Arrays数组的常用方法

    下面代码主要说明了Arrays数组的几个常用方法(红色字体) import java.util.Scanner;import java.util.Arrays;      public class T ...

  2. Spark Streaming、HDFS结合Spark JDBC External DataSouces处理案例

    场景:使用Spark Streaming接收HDFS上的文件数据与关系型数据库中的表进行相关的查询操作: 使用技术:Spark Streaming + Spark JDBC External Data ...

  3. WebForm分页浏览

    1.封装类 //封装类 using System; using System.Collections.Generic; using System.Web; /// <summary> // ...

  4. C&num; Environment类&lowbar;获取程序所在机器信息

    一.属性 CommandLine  获取该进程的命令行.CurrentDirectory 获取或设置当前工作目录的完全限定路径.ExitCode 获取或设置进程的退出代码.HasShutdownSta ...

  5. js 设置url 参数值

    //设置url中参数值 function setParam(param,value){ var query = location.search.substring(1); var p = new Re ...

  6. MySQL的4种事务隔离级别

    链接: https://www.cnblogs.com/huanongying/p/7021555.html https://blog.csdn.net/qq_33226422/article/det ...

  7. Boot-col-sm布局

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  8. C&plus;&plus;11 long long使用及输出

    相比于C++98标准,C++11整型的最大改变就是多了 long long.分为两种:long long 和unsigned long long.在C++11中,标准要求long long 整型可以在 ...

  9. 查询软件和硬件列表清单&lbrack;将文章里代码另存为 list&period;vbs&comma;双击运行就会出现一个html页面&rsqb;

    '==========================================================================' Name: 查询软件和硬件列表清单' 不支持W ...

  10. 部署经验Docker

    从Docker 到Jenkins 到Ansible的部署经验 https://www.cnblogs.com/itdragon/p/10011816.html 工作中,除了开发功能,还负责系统的部署工 ...