C# Write as Excel
<p>I am passing an argument to my method wherein the datatype of this is string, but this string is a binary type "UEsDBBQABgAIAAAAIQDfz5sukgEAAJQGAAATANwBW0NvbnRlbnRfVHlwZ" for example, then this parameter will then be written into an excel format.  The problem is, the file can be created but is corrupted due to invalid format.  The input parameter comes from an excel file but is read as binary.</p>

<p>My sample code is:</p>

<pre><code>public void writeFile(String fileContent)
{       
    // Write the string to a file.
    StreamWriter file = new StreamWriter("c:\\test2.xlsx");
    BinaryWriter bw = new BinaryWriter(file);

    bw.Write(fileContent);

    bw.Close();
    file.Close();
}
</code></pre>

<p>Thanks.</p>
