[英]How allow for '.' in an Excel file name when 'saving as' using late binding?
I just came up with this issue, we have a library that uses Reflection to manipulate Excel files. 我刚刚想到了这个问题,我们有一个使用Reflection来操纵Excel文件的库。 When a user is trying to save a file that has a
.
当用户尝试保存具有的文件时
.
in the file name (eg: 01.02.xls
) it won't include .xls in the saved file (result: 01.02
). 在文件名中(例如:
01.02.xls
),保存的文件中将不包含.xls(结果: 01.02
)。
workbook.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod, null, workbook, new Object[] { filepath.Remove(filepath.LastIndexOf(".")), 56 });
Is there an option that allows .
有没有允许的选项
.
inside the file name? 在文件名里面?
Why do you remove .xls from your filepath with 为什么您使用以下命令从文件路径中删除.xls
filepath.Remove(filepath.LastIndexOf("."))
I just tested this myself, if I use just filepath
as in 我只是这个测试自己,如果我只使用
filepath
作为
workbook.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod,
null, workbook, new Object[] { filepath, 56 });
it works for me 这个对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.