IIS下打印报表到Excel

8/10/2015来源:ASP.NET技巧人气:2819

IIS下打印报表到Excel

阅读本文之前,请先看上一篇文章《.NET下Excel报表的打印》。

上一篇文章《.NET下Excel报表的打印》介绍了关于报表打印到Excel文件中的方法。若要把项目通过IIS发布出来,还需要继续做以下配置。本文主要介绍在IIS中如何设置允许调用服务器上的Excel程序。只有设置了这些配置,报表打印才能在实际项目中得以应用。

第一步:

在服务器上安装office的Excel软件。

在"开始"->"运行"中输入dcomcnfg启动"组件服务"。

依次双击"组件服务"->"计算机"->"我的电脑"->"DCOM配置"。

在"DCOM配置"中找到"Microsoft Excel 应用程序",在它上面点击右键,然后点击"属性",弹出"Microsoft Excel 应用程序属性"对话框。

QQnorvU0aZmNVK1uqpas9VyVaVWSCUpLT0JehKODgAJ0AH0FrSgBUF4EN7ee+FBAiBIAARIwgMXhqTSSJkkM1M7tT3VvQ8XAMHMlKZqFvGPG4eXkPSkX3zf+c5hEU0bGtEFx4HgFBigg4E5MLAABZb0QYYhtGIMr5oia+boujW6YY2vW+PL5uiiMTKrD8/oQzNQaBoKT4LhKSg8Y4jMGiML5uiCJcawxpdtsdWd+PpuYsOeYL4uG/bEhiOx4Uhs2OF1R3LVkWQ4kkuO1IIjNe9I0+3paXt6cjc9vpMasaWGbEmqJdlvhvtMyR4TTDbB3Ua4y5joMiRISIzIAiYZ4S4j3GWEu00wxZzsMad6LSmqNTVkS4/upCd2MxP2zJQ9M2PP0O0ZuiNDRxb2NJKZ3HPGnp62p6ft6Rl7ZmY3M2PPID9O7WYzaUtNWJPjFnjCBI8bEhNQfByIjWujE5rohDoyqY5MKMNj8uCo7GRIfEQV+fuFhz0CTzfPTeQddAg9bduHOIkfIz/BqIJoTaQFiLVAiWZ9olkPN+vhJj3cpIcb9clGPdyohxuhbBqgZD0E10NwHfIEk3VgshaC60C4NptkDZhEnjUgXAPCNdl1PqkaMIlC1hDyY6oGTNVAqVooVQOlasFULZRNHbLQp+qgdD71+nS9Pl2nT9frM/X6TIMhU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