We have a code generator that munges the schema of a given database to automate our inhouse n-tier architecture. The output is various C# partial classes, one per file. >
To Expand on Cherian's answer:
NArrange will allow you to do a lot of code formatting. It is open source, and the source is available on their site, so you could potentially integrate and redistbute it with your tool.
You should only need the dll's and just look at the exe on how to call the formatting. It will also create a backup of the code being formatted. It is really a nice tool if it fits your needs.