54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.IO;
|
|||
|
|
|||
|
namespace FineUIPro.Web.AttachFile
|
|||
|
{
|
|||
|
public partial class Look : PageBase
|
|||
|
{
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
|
|||
|
var url = Request.Params["fileUrl"];
|
|||
|
var Baseurl = "https://view.officeapps.live.com/op/embed.aspx?src=";
|
|||
|
// var Baseurl = "https://view.xdocin.com/view?src=";
|
|||
|
var Fileurl = Funs.SGGLUrl + url.Replace(Funs.RootPath, "").Replace("#", "%23");
|
|||
|
var newurl = "";
|
|||
|
var FiletExtension = Path.GetExtension(url);
|
|||
|
if (FiletExtension == ".docx" || FiletExtension == ".doc" || FiletExtension == ".xls" || FiletExtension == ".xlsx")
|
|||
|
{
|
|||
|
newurl = Baseurl + Fileurl;
|
|||
|
}
|
|||
|
else if ( FiletExtension == ".jpg" || FiletExtension == ".jpeg" || FiletExtension == ".png" || FiletExtension == ".gif")
|
|||
|
{
|
|||
|
newurl = Fileurl;
|
|||
|
TabStrip1.Hidden = true;
|
|||
|
Response.Write(string.Format("<div id=\"galley\" >\r\n <ul class=\"pictures\">\r\n <li>\r\n <img data-original=\"{0}\" src=\"{1}\" alt=\"Picture 1\" />\r\n </li> \r\n <!-- 更多图片 -->\r\n </ul>\r\n </div><a >点击图片查看详情</a>", newurl, newurl));
|
|||
|
|
|||
|
}
|
|||
|
else if (FiletExtension == ".txt" || FiletExtension == ".pdf" )
|
|||
|
{
|
|||
|
newurl = Fileurl;
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newurl = Fileurl;
|
|||
|
}
|
|||
|
|
|||
|
// this.LookHtml.Src = newurl;
|
|||
|
this.Tab1.IFrameUrl = newurl;
|
|||
|
//StreamReader fread = new StreamReader(url, System.Text.Encoding.GetEncoding("gb2312"));
|
|||
|
//string ss = fread.ReadToEnd();
|
|||
|
//Response.Write(ss);
|
|||
|
//fread.Close();
|
|||
|
//fread.Dispose();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|