public static void Export(List <string> fileList) { // 清空多语言管理器的缓存数据 LanguageMgr.Instance.ClearCacheLanguage(); // 加载多语言总表 LanguageMgr.Instance.LoadAutoGenerateLanguageToCache(); // 加载选择的Excel文件列表 for (int i = 0; i < fileList.Count; i++) { string filePath = fileList[i]; ExcelData excelFile = new ExcelData(filePath); if (excelFile.Load()) { if (excelFile.Export()) { // 导出成功后,我们解析表格的多语言数据 var data = LanguageMgr.ParseLanguage(excelFile); LanguageMgr.Instance.CacheLanguage(data); } } excelFile.Dispose(); } // 创建新的多语言总表文件 LanguageMgr.Instance.CreateAutoGenerateLanguageFile(); // 导出多语言总表文件 LanguageMgr.Instance.ExportAutoGenerateLanguageFile(); }
/// <summary> /// 导出生成按钮 /// </summary> private void createButton_Click(object sender, EventArgs e) { // 清空多语言管理器的缓存数据 LanguageMgr.Instance.ClearCacheLanguage(); // 加载多语言总表 LanguageMgr.Instance.LoadAutoGenerateLanguageToCache(); // 加载选择的Excel文件列表 for (int i = 0; i < fileListBox.Items.Count; i++) { string filePath = (string)fileListBox.Items[i]; ExcelData excelFile = new ExcelData(filePath); if (excelFile.Load()) { if (excelFile.Export()) { // 导出成功后,我们解析表格的多语言数据 var data = LanguageMgr.ParseLanguage(excelFile); LanguageMgr.Instance.CacheLanguage(data); } } excelFile.Dispose(); } // 创建新的多语言总表文件 LanguageMgr.Instance.CreateAutoGenerateLanguageFile(); // 导出多语言总表文件 LanguageMgr.Instance.ExportAutoGenerateLanguageFile(); MessageBox.Show("导表完成."); }
/// <summary> /// 导出多语言总表文件 /// </summary> public void ExportAutoGenerateLanguageFile() { string filePath = ExportConfig.Instance.LastOpenExcelPath + "\\" + StrAutoGenerateLanguageExcelName + ".xlsx"; if (File.Exists(filePath)) { ExcelData excelFile = new ExcelData(filePath); if (excelFile.Load()) { excelFile.Export(); } } }
/// <summary> /// 导出多语言总表文件 /// </summary> public void ExportAutoGenerateLanguageFile() { string filePath = Path.Combine(ExportConfig.Instance.ExcelPath, StrAutoGenerateLanguageExcelName + ".xlsx"); if (File.Exists(filePath)) { ExcelData excelFile = new ExcelData(filePath); if (excelFile.Load()) { excelFile.Export(); } } }