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();    

             }    

         }

    如果你总是等来等去,最终什么都没有等到
  • 相关阅读:
    Codeforces 689A Mike and Cellphone
    栈的一些基本操作
    Intersecting Lines POJ 1269
    Segments POJ 3304 直线与线段是否相交
    Toy Storage POJ 2398
    CF471D MUH and Cube Walls
    P 3396 哈希冲突 根号分治
    P1445 [Violet]樱花
    P6810 「MCOI-02」Convex Hull 凸包
    P3455 [POI2007]ZAP-Queries
  • 原文地址:https://www.cnblogs.com/jiaguo648517982/p/3012150.html
Copyright © 2011-2022 走看看