代码之家  ›  专栏  ›  技术社区  ›  chunhunghan

在Windows上打开Excel文件

  •  0
  • chunhunghan  · 技术社区  · 5 年前

    用于在Windows平台上运行颤振,我使用go颤振桌面来实现这一点。
    我需要在点击按钮的同时打开Excel文件。
    经过长时间的挣扎,我想分享一下这个片段

    0 回复  |  直到 5 年前
        1
  •  5
  •   chunhunghan    5 年前
    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);
                        }
                      }
    

    enter image description here