Making exported excel sheet as readonly
<p>In my application i'm exporting gridview data to excel and storing it to a particular folder now what i want is to make this excel file as read only so that no one should edit it.</p>

<p>i have written code like this:</p>

<p>protected void Button5_Click(object sender, EventArgs e)
       {</p>

<pre><code>        this.GridView1.Page.EnableViewState = false;
        StringWriter tw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(tw);
        hw.WriteLine("&lt;b&gt;&lt;font size='5'&gt; Report&lt;/font&gt;&lt;/b&gt;");
        this.GridView1.RenderControl(hw);
        string HtmlInfo = tw.ToString();
        string DocFileName = "Report" + ".xls";
        string FilePathName = Request.PhysicalPath;
        FilePathName = FilePathName.Substring(0, FilePathName.LastIndexOf("\\"));
        FilePathName = @"C:\Excel" + "\\" + DocFileName;
        FileStream Fs = new FileStream(FilePathName, FileMode.Create);
        BinaryWriter BWriter = new BinaryWriter(Fs,System.Text.Encoding.GetEncoding("UTF-8"));
        BWriter.Write(HtmlInfo);
        BWriter.Close();
        Fs.Close();

   }
</code></pre>

<p>any1 help me on this...</p>
