ASP.NET如何实现把doc文档转成swf文件?

在做一个小网站,需要实现资料预览功能,就是点击上传按钮把上传的doc、docx、xls、ppt、txt等文档转成swf格式文件存到网站某一目录下,怎么实现?... 在做一个小网站,需要实现资料预览功能,就是点击上传按钮把上传的doc、docx、xls、ppt、txt等文档转成swf格式文件存到网站某一目录下,怎么实现? 展开
 我来答
888小胖胖888
推荐于2016-02-06
知道答主
回答量:31
采纳率:0%
帮助的人:11.4万
展开全部
(1)安装FlashPape:下载FlashPape压缩包,解压缩后,运行初始化目录中的初始化.bat,然后安装FlashPaperDriverInstall2.exe,即FlashPaper打印机。特别注意,在有的机器上要更改Macromedia
FlashPape的端口,应为FlashPape2PrinterPort,如果是LPT1这个端口,当然打印不出来了。
(2)为页面中的按钮编写事件处理代码:
程序代码
Process
process = new Process(); //创建进程对象
//try
//{

ProcessStartInfo startInfo = new ProcessStartInfo();

string paperroot = @"C:\Program Files\Macromedia\FlashPaper
2\FlashPrinter.exe";
string docFile =
Server.MapPath("1.doc");
string swfFile =
Server.MapPath("1.swf");
startInfo.FileName = paperroot;

startInfo.Arguments = docFile + " -o " + swfFile;

startInfo.UseShellExecute = false; //不使用系统外壳程序启动

startInfo.RedirectStandardInput = false; //不重定向输入

startInfo.RedirectStandardOutput = false; //重定向输出

startInfo.CreateNoWindow = true; //不创建窗口
process.StartInfo
= startInfo;
process.Start();

Response.Write("已经提交生成。<br />");

Response.Write(paperroot+"<br />"+docFile + " = " + swfFile);

//}
//catch (Exception ex)
//{
//
Response.Write(ex.Message);
//}
//finally

//{
if (process != null)

process.Close();
// Response.Write("<br />finally");

//}
注意:有人说,FlashPrinter.exe所在的目录名称中不能有空格,否则转换失败。其实我上面的不不带空格了它同样转换成功了。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式