在.net里面使用FlashPrinter实现将word文件转换为swf文件(做的测试玩的)

1.在网上下载FlashPaper.rar,并且要成功的在你的电脑上安装完毕。

2.页面

<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="wordPath" runat="server"></asp:TextBox>
        <asp:Button ID="BtnGo" runat="server" Text="转换" οnclick="BtnGo_Click" />
        <asp:TextBox ID="swfPath" runat="server"></asp:TextBox>
    </div>
    </form>
</body>

3.后台


        /// <summary>
        /// 将word文档转换为swf文档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnGo_Click(object sender, EventArgs e)
        {
            string wordFilePath = this.wordPath.Text.Trim(); //word文件的全路径
            string swfFilePathBegin = this.swfPath.Text.Trim();   //swf文件的存放最初路径
            //截取word的文件的文件名称
            string file = wordFilePath.Substring(wordFilePath.LastIndexOf("\\")+1); //去掉前缀
           // string wordFileName = wordFilePath.Substring(wordFilePath.LastIndexOf("/")+1,wordFilePath.LastIndexOf(".")-wordFilePath.LastIndexOf("/")-1); //去掉后缀,但还有前缀
            string wordFileName = file.Substring(0,file.LastIndexOf("."));//去掉后缀
            string swfFileName = wordFileName+System.DateTime.Now.ToString("yyyyMMddhhmmss");
            string swfFilePath = swfFilePathBegin+"\\"+swfFileName + ".swf";
            Process process = new Process();  //本地系统进程
            ProcessStartInfo startInfo = new ProcessStartInfo(); //指定启动进程时使用的一组值
            string parperroot = @"D:\Wind-5368\下载资料\wordtoswf转换\flashpaper\FlashPaper2.2\FlashPrinter.exe";
            startInfo.FileName = parperroot;
            startInfo.Arguments = wordFilePath + " -o " + swfFilePath;
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardInput = false;
            startInfo.RedirectStandardOutput = false;
            startInfo.CreateNoWindow = true;
            process.StartInfo = startInfo;
            process.Start();
            Response.Write("已经提交生成!<br />");
            Response.Write(parperroot + "<br />" + wordFilePath + " = " + swfFilePath);
            if(process != null){
                process.Close();
            }           
        }


4.执行后




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值