Flat File (Fixed Width) File Generator in C#
I came up with a custom attribute and class that would allow you to generate a fixed width file from a list of objects.
Basically, you create a class to store a file record. Apply the FlatFileAttribute the the class properties describing where a field starts and how long it is. You then pass a list of objects of your record type along with a file path to the writeFile method. Out comes a file in the format you specified in your record class.
Check out the code here https://github.com/mbowcock/flat-file-generator
Leave a comment