20251024 附件预览
This commit is contained in:
parent
a1a2e05432
commit
1680def4f4
|
|
@ -454,5 +454,37 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断文件类型是否支持的预览
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="FiletExtension"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsSupportFileType(string FiletExtension)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
List<String> list = new List<string>();
|
||||||
|
list.Add("doc");
|
||||||
|
list.Add("docx");
|
||||||
|
list.Add("pdf");
|
||||||
|
list.Add("txt");
|
||||||
|
list.Add("xlsx");
|
||||||
|
list.Add("xls");
|
||||||
|
list.Add("jpg");
|
||||||
|
list.Add("png");
|
||||||
|
list.Add("gif");
|
||||||
|
list.Add("jpeg");
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
if (item == FiletExtension)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -346,6 +346,7 @@ namespace FineUIPro.Web.AttachFile
|
||||||
{
|
{
|
||||||
string savedName = item.Value<string>("savedName");
|
string savedName = item.Value<string>("savedName");
|
||||||
string folder = item.Value<string>("folder");
|
string folder = item.Value<string>("folder");
|
||||||
|
string type = item.Value<string>("type");
|
||||||
string xnUrl = AttachPath + "\\" + savedName;
|
string xnUrl = AttachPath + "\\" + savedName;
|
||||||
if (!string.IsNullOrEmpty(folder))
|
if (!string.IsNullOrEmpty(folder))
|
||||||
{
|
{
|
||||||
|
|
@ -363,28 +364,41 @@ namespace FineUIPro.Web.AttachFile
|
||||||
url = Funs.RootPath + "Images//Null.jpg";
|
url = Funs.RootPath + "Images//Null.jpg";
|
||||||
info = new FileInfo(url);
|
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, "查看 -")));
|
|
||||||
|
|
||||||
}
|
bool isSupportType = AttachFileService.IsSupportFileType(type);
|
||||||
else if (FiletExtension == ".txt")
|
if (isSupportType)
|
||||||
{
|
{
|
||||||
|
url = url.Replace(Funs.RootPath, "").Replace("#", "%23");
|
||||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", url, "查看 -")));
|
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
|
else
|
||||||
{
|
{
|
||||||
ShowNotify("不支持预览", MessageBoxIcon.Warning);
|
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)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue