zoukankan      html  css  js  c++  java
  • 网页浏览文件

    /// <summary>     /// 查看     /// </summary>     /// <param name="sender"></param>     /// <param name="e"></param>     protected override void btnView_Click(object sender, EventArgs e)     {         string ids = this.hidKey.Value;         string[] queryArray = ids.Split('_');

            string bureauCode = queryArray[0];         string deptCode = queryArray[1];

            int iPlanNo = 0;         int.TryParse(queryArray[2], out iPlanNo);

            string filePath = bll.GetFilePathByCondition(bureauCode, deptCode, iPlanNo);

            string localPath = HttpRuntime.AppDomainAppPath.ToString();         string inputPath = localPath + filePath.Replace("~", "");

            if (!File.Exists(inputPath))         {             ShowMessage("error", "文件查看失败!该文件可能已被删除!");             return;         }

            string extension = System.IO.Path.GetExtension(filePath);         if (extension.Equals(".doc", StringComparison.OrdinalIgnoreCase))         {             WordPreview.Priview(this, inputPath, localPath);         }         else if (extension.Equals(".txt", StringComparison.OrdinalIgnoreCase))         {             TextFilePreview.Preview(this, inputPath);         }         else if (extension.Equals(".pdf", StringComparison.OrdinalIgnoreCase))         {             PDFPreview.Priview(this, inputPath);         }         else if (extension.Equals(".xlsx", StringComparison.OrdinalIgnoreCase))         {             ExcelPreview.Priview(this, inputPath, localPath);         }         if (extension.Equals(".docx", StringComparison.OrdinalIgnoreCase))         {             WordPreview.Priview(this, inputPath, localPath);         }

        }

  • 相关阅读:
    《剑指offer》JavaScript版(4-6题)
    HDU 4906 Our happy ending(2014 Multi-University Training Contest 4)
    POJ 1436 Horizontally Visible Segments
    FOJ 2105 Digits Count
    HDU 4890 One to Four(2014 Multi-University Training Contest 3)
    HDU 4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)
    HDU 4893 Wow! Such Sequence!(2014 Multi-University Training Contest 3)
    POJ 3225 Help with Intervals
    HDU 1698 Just a Hook
    POJ 2886 Who Gets the Most Candies?
  • 原文地址:https://www.cnblogs.com/hanjiaxu/p/6134680.html
Copyright © 2011-2022 走看看