本文介绍了在ASP.net C#中打印Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用互操作服务生成Excel文件,我可以将文件保存到服务器上.当我尝试使用以下代码进行打印时,如果我在本地运行,则会被打印.

worksheet.PrintOut(Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing)

如果我将应用程序托管在IIS中,则这部分代码会出现错误
Microsoft Office Excel无法访问文件"D:\ file.xls".

Hi,

Iam generating a Excel file using interop services.I could save the file to my server. When i try to print using the below code it is printed if i run locally.

worksheet.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing)

If i host the application in IIS ,i get error at this part of the code
Microsoft Office Excel cannot access the file ''D:\file.xls''.

Workbook.Open(filePath,
           Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
           Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
           Type.Missing, Type.Missing, Type.Missing, Type.Missing);



我使用server.mappath保存文件.
请提出建议.

在此先感谢



I use server.mappath to save the file.
Suggestions please.

Thanks in advance

推荐答案


这篇关于在ASP.net C#中打印Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 23:43
查看更多