如何在打开文档的同时打开任何应用程序(如word,pdf reader)的打印对话框,程序化 [英] How to open print dialog box of any application (like word,pdf reader) on the same time while openning the document, Programmitically

查看:247
本文介绍了如何在打开文档的同时打开任何应用程序(如word,pdf reader)的打印对话框,程序化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用C#,asp.net作为工具。



我使用以下代码传输和打开客户端的文件,并希望在客户端打开文档的同时打开任何应用程序的内置打印对话框(如word,pdf阅读器)。



  if (fileFormat.ToUpper()==  < span class =code-string> Excel)
{
Response.ContentType = 应用/ vnd.ms-EXCEL;
}
else if (fileFormat.ToUpper()== PDF
{
Response.ContentType = application / pdf;
}

Response.AddHeader( Content-Disposition string .Format( attachment; filename = {0 },fi.Name));
Response.AddHeader( Content-Length,fi.Length.ToString()) ;
Response.TransmitFile(fi.FullName);
Response.End();

解决方案

在打开提供下载的Excel和Word文档时添加VBA宏以显示打印对话框

Hi,
I am using C#, asp.net as tools.

I am using the following code to transmit and open a file at client side and want to open built-in print dialog box of any application (like word,pdf reader) on the same time while opening the document at client side.

if (fileFormat.ToUpper() == "Excel")
{
    Response.ContentType = "application/vnd.ms-excel";
}
else if (fileFormat.ToUpper() == "PDF")
{
    Response.ContentType = "application/pdf";
}

Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", fi.Name));
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.TransmitFile(fi.FullName);
Response.End();

解决方案

Add a VBA macro to show Print dialog when open Excel and Word documents which are provided for download


这篇关于如何在打开文档的同时打开任何应用程序(如word,pdf reader)的打印对话框,程序化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆