在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
前文:Excel,Word,PPT,PDF 在线预览 做个备份,拿的是试用版的 Aspose,功能见标题 代码:1 /// <summary> 2 /// Aspose office (Excel,Word,PPT),PDF 在线预览 3 /// </summary> 4 /// <param name="sourceDoc">需要预览的文件地址</param> 5 /// <param name="saveDoc">展示的html文件地址</param> 6 public void Goto(string sourceDoc, string saveDoc) 7 { 8 string s_sourceDoc = Server.MapPath(sourceDoc); 9 10 string s_saveDoc = Server.MapPath(saveDoc); 11 12 string docExtendName = Path.GetExtension(s_sourceDoc).ToLower(); 13 14 switch (docExtendName) 15 { 16 case ".doc": 17 case ".docx": 18 Aspose.Words.Document doc = new Aspose.Words.Document(s_sourceDoc); 19 doc.Save(s_saveDoc, Aspose.Words.SaveFormat.Html); 20 Response.Redirect(saveDoc); 21 break; 22 case ".xls": 23 case ".xlsx": 24 Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(s_sourceDoc); 25 workbook.Save(s_saveDoc, Aspose.Cells.SaveFormat.Html); 26 Response.Redirect(saveDoc); 27 break; 28 case ".ppt": 29 case ".pptx": 30 Aspose.Slides.Pptx.PresentationEx pres = new Aspose.Slides.Pptx.PresentationEx(s_sourceDoc); 31 pres.Save(s_saveDoc, Aspose.Slides.Export.SaveFormat.Html); 32 Response.Redirect(saveDoc); 33 break; 34 case ".pdf": 35 Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(s_sourceDoc); 36 pdf.Save(s_saveDoc, Aspose.Pdf.SaveFormat.Html); 37 Response.Redirect(saveDoc); 38 break; 39 } 40 }
地址:http://download.csdn.net/detail/hou3125378/9909973
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论