20251024 附件预览

This commit is contained in:
2025-10-24 16:58:10 +08:00
parent a1a2e05432
commit 1680def4f4
2 changed files with 60 additions and 14 deletions
@@ -346,6 +346,7 @@ namespace FineUIPro.Web.AttachFile
{
string savedName = item.Value<string>("savedName");
string folder = item.Value<string>("folder");
string type = item.Value<string>("type");
string xnUrl = AttachPath + "\\" + savedName;
if (!string.IsNullOrEmpty(folder))
{
@@ -363,28 +364,41 @@ namespace FineUIPro.Web.AttachFile
url = Funs.RootPath + "Images//Null.jpg";
info = new FileInfo(url);
}
var FiletExtension = Path.GetExtension(savedName);
if (FiletExtension == ".docx" || FiletExtension == ".pdf")
{
string httpUrl = BLL.AsposeWordHelper.WordToHtml(url);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
}
else if (FiletExtension == ".txt")
bool isSupportType = AttachFileService.IsSupportFileType(type);
if (isSupportType)
{
url = url.Replace(Funs.RootPath, "").Replace("#", "%23");
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", url, "查看 -")));
}
else if (FiletExtension == ".xls")
{
string httpUrl = BLL.AsposeWordHelper.PriviewExcel(url);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
}
else
{
ShowNotify("不支持预览", MessageBoxIcon.Warning);
}
//var FiletExtension = Path.GetExtension(savedName);
//if (FiletExtension == ".docx" || FiletExtension == ".pdf")
//{
// string httpUrl = BLL.AsposeWordHelper.WordToHtml(url);
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
//}
//else if (FiletExtension == ".txt")
//{
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", url, "查看 -")));
//}
//else if (FiletExtension == ".xls")
//{
// string httpUrl = BLL.AsposeWordHelper.PriviewExcel(url);
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
//}
//else
//{
// ShowNotify("不支持预览", MessageBoxIcon.Warning);
//}
}
catch (Exception)
{