-
/// <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;
-
}
-
}