Exemplo n.º 1
0
        private void btnBindExcel_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dictSource = new Dictionary <string, object>();

            dictSource.Add("ACCUSER_SEX", "男");
            dictSource.Add("ACCUSER_TEL", "18620292076");

            string templateFile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Templates/Advice.xls");
            string savedFile    = AsposeExcelTools.ExportWithDataSource(templateFile, "testAdvice.xls", dictSource);

            if (!string.IsNullOrEmpty(savedFile))
            {
                if (MessageDxUtil.ShowYesNoAndTips("导出成功,是否打开文件?") == System.Windows.Forms.DialogResult.Yes)
                {
                    Process.Start(savedFile);
                }
            }
        }