Exemplo n.º 1
0
        static void ExportExcel()
        {
            string autoFile = Path.Combine(ExportConfig.Instance.ExcelPath, LanguageMgr.StrAutoGenerateLanguageExcelName + ".xlsx");

            if (File.Exists(autoFile))
            {
                File.Delete(autoFile);
            }

            string[] files = Directory.GetFiles(ExportConfig.Instance.ExcelPath, "*.*", SearchOption.AllDirectories);

            List <string> fileList = new List <string>();

            for (int i = 0; i < files.Length; i++)
            {
                if (pType == 1 && (files[i].Contains("/Android") || files[i].Contains("\\Android")))
                {
                    continue;
                }

                if (pType == 2 && (files[i].Contains("/IOS") || files[i].Contains("\\IOS")))
                {
                    continue;
                }

                if (files[i].EndsWith(".xlsx") || files[i].EndsWith(".xls"))
                {
                    fileList.Add(files[i]);
                }
            }

            // 导出Excel文件列表
            ExportCenter.Export(fileList);
        }
Exemplo n.º 2
0
    /// <summary>
    /// 导出生成按钮
    /// </summary>
    private void createButton_Click(object sender, EventArgs e)
    {
        // 获取选择的Excel文件列表
        List <string> fileList = new List <string>();

        for (int i = 0; i < fileListBox.Items.Count; i++)
        {
            string filePath = (string)fileListBox.Items[i];
            fileList.Add(filePath);
        }

        // 导出Excel文件列表
        ExportCenter.Export(fileList);

        MessageBox.Show("导表完成.");
    }