I'm implementing a file download in ofx, I am generating the string and then adding it to a StreamWriter , however if I add row by row or add the entire string at once without breaking lines, it creates a multi-line file in the blank end, after the contents of the string, follow the code:
string ofx = metodoQueRetornaString();
MemoryStream stream = new MemoryStream();
StreamWriter file = new StreamWriter(stream, Encoding.UTF8, 512);
file.Write(ofx.Replace("\n", file.NewLine));
file.Flush();
file.Close();
The string ofx returns with something like:
OFXHEADER:100\n<OFX>\n<INFORMAÇÕES DO OFX>\n</OFX>
You should create a file with the content:
OFXHEADER:100
<OFX>
<INFORMAÇÕES DO OFX>
</OFX>
You are creating a file with this content:
OFXHEADER:100
<OFX>
<INFORMAÇÕES DO OFX>
</OFX>
'
Note: I put these accents just to represent the empty lines.