Flutter desktop / go-flutter-desktop Open Excel Fi

2019-08-29 03:41发布

问题:

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);
                    }
                  }



标签: dart flutter