For running Flutter on Windows platform and I do this with go-flutter-desktop.
I need to open Excel file while click button.
After long struggling, I would like to share this snippet
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
import 'dart:io';
...
onTap: () {
String win10Path =
'C:\\progra~1\\MIF5BA~1\\Office16\\EXCEL.EXE';
String win7Path =
'C:\\progra~2\\micros~1\\Office14\\EXCEL.EXE';
//'C:\\progra~1\\MIF5BA~1\\Office16\\EXCEL.EXE'
try {
print('process start');
Process.run(win7Path, ['C:\\test.xlsx'])
.then((ProcessResult results) {
print(results.stdout);
});
} catch (e) {
print(e);
}
}