private void bt_parse_mmldoc_Click(object sender, EventArgs e) { //解析doc文档 // DialogResult result = MessageBox.Show("请确保:" + selected_doc + " 文件已备份!!!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (DialogResult.Yes == DialogResult.Yes) { DocParser parser = new DocParser(selected_doc); rtb_dumpinfo.register(parser); probar_parse.register(parser); //初始化输出文档 MMLOutputTxt output_txt = new MMLOutputTxt(); string txt_file = selected_doc.Remove(selected_doc.Length - 5) + ".txt"; //xxx.docx output_txt.init(txt_file); output_txt.register(parser); int ret = parser.parser_files(); rtb_dumpinfo.AppendText(Helper.get_errinfo(ret) + "\n"); // MessageBox.Show("处理结果:" + Helper.get_errinfo(ret) + "。", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { return; } }
public void register(DocParser parser) { parser.ParserEvt += new DocParser.ParserEventHandler(handle_parser_result); }