zoukankan      html  css  js  c++  java
  • C#中在.xhtml文件中include的html文件,生成出现的空格问题

    当需要在.xhtml页面中引用html文件时,在生成html文件需要生成为【不带签名】的html,否则在生成的html文件中有空格,这样会影响页面的布局

    代码如下:希望大家可以多多指教

      private void CreateTopCityHtml()    

         {          

       string cityHtml = GetTopCityHtml();   //获取html片段     

         string strLAWebRoot = System.Configuration.ConfigurationManager.AppSettings["root"].ToString();//从web.config中读取的

                string savePath = strLAWebRoot + "\\html\\index\\city\\";   

              if (!System.IO.Directory.Exists(savePath))         

        {                

    System.IO.Directory.CreateDirectory(savePath);       

          }            

    string fileName = "topcity.htm";       

          string filepath = Path.Combine(savePath, fileName);       

          UTF8Encoding utf8 = new UTF8Encoding(false);  //不带签名的    

           using (StreamWriter streamWriter = new StreamWriter(filepath, false, utf8)) //保存地址        

         {                

    streamWriter.WriteLine(cityHtml);      

               streamWriter.Flush();        

             streamWriter.Close();    

             }    

         }

    如果你总是等来等去,最终什么都没有等到
  • 相关阅读:
    2020软件工程最后一次作业
    常用的10种算法

    赫夫曼编码
    哈希表(散列)
    查找算法
    排序算法
    递归

    软件工程最后一次作业
  • 原文地址:https://www.cnblogs.com/jiaguo648517982/p/3012150.html
Copyright © 2011-2022 走看看