It depends on exactly what you do to save and restore the data: unless you export the data in RTF and import it back as RTF, then no formatting is preserved - TXT files do not have or understand any formatting, they are just a string of characters.
So look at what your saved files contain - it should look like this:
{\rtf1\ansi\deff0 {\fonttbl {\f0 Times New Roman;}}
\f0\fs60 Hello, World!
}
If it does, then look at what you do when you load it.
If it doesn't, then you need to use the debugger to find out what you are actually saving.
We can't do that for you - we have no access to your code or data files!