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.执行后