Implement the export to txt function. close #94.