首页 > 代码库 > Aspose office (Excel,Word,PPT),PDF 在线预览
Aspose office (Excel,Word,PPT),PDF 在线预览
就是做个备份,拿的是试用版的 Aspose
-
/// <summary>
-
/// Aspose office (Excel,Word,PPT),PDF 在线预览
-
/// </summary>
-
/// <param name="sourceDoc">需要预览的文件地址</param>
-
/// <param name="saveDoc">展示的html文件地址</param>
-
public void Goto(string sourceDoc, string saveDoc)
-
{
-
string s_sourceDoc = Server.MapPath(sourceDoc);
-
-
string s_saveDoc = Server.MapPath(saveDoc);
-
-
string docExtendName = Path.GetExtension(s_sourceDoc).ToLower();
-
-
switch (docExtendName)
-
{
-
case ".doc":
-
case ".docx":
-
Aspose.Words.Document doc = new Aspose.Words.Document(s_sourceDoc);
-
doc.Save(s_saveDoc, Aspose.Words.SaveFormat.Html);
-
Response.Redirect(saveDoc);
-
break;
-
case ".xls":
-
case ".xlsx":
-
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(s_sourceDoc);
-
workbook.Save(s_saveDoc, Aspose.Cells.SaveFormat.Html);
-
Response.Redirect(saveDoc);
-
break;
-
case ".ppt":
-
case ".pptx":
-
Aspose.Slides.Pptx.PresentationEx pres = new Aspose.Slides.Pptx.PresentationEx(s_sourceDoc);
-
pres.Save(s_saveDoc, Aspose.Slides.Export.SaveFormat.Html);
-
Response.Redirect(saveDoc);
-
break;
-
case ".pdf":
-
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(s_sourceDoc);
-
pdf.Save(s_saveDoc, Aspose.Pdf.SaveFormat.Html);
-
Response.Redirect(saveDoc);
-
break;
-
}
-
}
http://download.csdn.net/detail/hou3125378/9909973
Aspose office (Excel,Word,PPT),PDF 在线预览
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。