using Common;
using System.Web.Mvc;
using Lib;
namespace wms.Areas.SyetemSet.Controllers
{
public class OfficeViewController : AjaxPage
{
#region Index页面
///
/// Index页面
///
/// 例:/uploads/......XXX.xls
public ActionResult Index(string url)
{
string physicalPath = Server.MapPath(Server.UrlDecode(url));
string extension = System.IO.Path.GetExtension(physicalPath);
string htmlUrl = "";
switch (extension.ToLower())
{
case ".xls":
case ".xlsx":
htmlUrl = OfficeView. PreviewExcel(physicalPath, url);
break;
case ".doc":
case ".docx":
htmlUrl = OfficeView.PreviewWord(physicalPath, url);
break;
case ".txt":
htmlUrl = OfficeView.PreviewTxt(physicalPath, url);
break;
case ".pdf":
htmlUrl = OfficeView.PreviewPdf(physicalPath, url);
break;
}
return Redirect(Url.Content(htmlUrl));
}
#endregion
}
}