How to export data from table to word file in MSD Axapta


 CommaIo urfile;  
 LedgerTrans LedgerTrans1;  
 Container container1;  
 sqlDictionary sqlDictionary;  
 TableName tablenm;  
 ;  
 tablenm = "LedgerTrans1";  
 select * from sqlDictionary where Tablename2id(tablenm) == sqlDictionary.tabId;  
 if(sqlDictionary.RecId > 0)  
 {  
 urfile= new CommaIo("c:\\test.doc","w");  
 urfile.outFieldDelimiter("\t");/  
 while select LedgerTrans1  
 {  
 container1= [LedgerTrans1.AccountNum,LedgerTrans1.Txt];  
 urfile.writeExp(container1);  
 }  
 }