问题描述
我必须使用Office.FileDialog [Office.MsoFileDialogType.msoFileDialogSaveAs]
因为我想检查他们将文档保存在何处。
因此,我检查扩展名并根据扩展名更改方法。
但是xmlData和xmlSpreadSheet是彼此相同的扩展名。
此插件在多个国家/地区使用。我不想使用Office.FileDialogFilter.Description。
如果过滤顺序与语言无关,我将根据filterindex更改方法。
您有判断xmlData或xmlSpreadSheet的好主意吗?
铃木A
・操作系统:windows10
・ Office:Office2016
・ .Net框架:4.5.2
void Application_WorkbookBeforeSave(Microsoft.Office.Interop.Excel.Workbook Wb,bool SaveAsUI,ref bool Cancel)
{
Office.FileDialog _dialog = Application.FileDialog[Office.MsoFileDialogType.msoFileDialogSaveAs];
// I want to set selected folder
_dialog.InitialFileName = System.IO.Path.Combine(Directory.GetCurrentDirectory(),Wb.Name);
if (_dialog.Show() != 0)
{
// Todo Some extensions have to change save method
int _index = _dialog.FilterIndex;
// filter can get extension and description
Office.FileDialogFilter _filter = _dialog.Filters.Item(_index);
// Are filter orders same reagardless of the language?
// Are there other way to judge xmlData or xmlSpreadSheet ?
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)