Setting The Output File Stream
Creating an EDI document is easy with the EDIDocument component. The EDIDocument component contains a constructor that accepts a FileStream object Initializing a FileStream object and passing it to the EDIDocument constructor will cause any EDI document generated to be written to that specific stream.
// Create a filestream object
FileStream myStream = new StreamWriter(“C:\\edi.txt”);
// Instantiate an instance of EDIDocument and set the filestream parameter
EDIDocument sampleEDIFile = new EDIDocument(myStream);
// Create an interchange loop. This loop will contain all other loops in the EDI structure
Loop interchangeHeaderLoop = new Loop(“Interchange Header”);
// Add the interchange loop to the EDI document
// Generate the EDI file
You can also explicitly set the FileStream property of EDIDocument.