I have a simple code to write some text to a .docx file.
using (FileStream fs = new FileStream(filepath, FileMode.Open))
using (StreamWriter sw = new StreamWriter(fs, Encoding.Unicode))
{
sw.WriteLine("something");
}
this writes to the file but when I try to open the file with MsWord it gives error
microsoft office cannot open this file because some parts are missing or invalid
but if I try to open the same file with wordpad or notepad, it opens and the text is written correctly. Why would this be?