无法在任何地方以自动化方式打开Excel电子表格

时间:2018-09-04 13:59:56

标签: automation automationanywhere

我正在使用Automation Anywhere将值插入到Excel文件中。我使用下面的代码打开电子表格。但是,电子表格正在excel应用程序中打开,而不是在我的计算机中打开Microsoft Excel。我没有Outlook Excel App的许可证。

<?php
 $curyear = date('Y');
 $con = mysqli_connect('xxxx','xxxx','xxxx','xxxx');
?>
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
       var data = google.visualization.arrayToDataTable([
        ['Date', 'Pezzi',],
         <?php 
            $query = "SELECT responsabile, sum(n_sim)+sum(n_accessi) as pezzi, data_dichiarato FROM dichiarati WHERE responsabile = 'ADMRZ01' and n_ragsoc != 'DICHIARATO ZERO' and YEAR(DATA_DICHIARATO) = '$curyear' GROUP BY MONTH(data_dichiarato) ORDER BY data_dichiarato";
            $exec = mysqli_query($con,$query);
            while($row = mysqli_fetch_array($exec)){

            echo "['".date("M", strtotime($row['data_dichiarato']))."',".$row['pezzi']."],";

         }

        ?>

       ]);


        // Set chart options
        var options = {'title':'SIM CONSEGNATE NEL <?php echo $curyear; ?>',
                       'width':1200,
                       'height':300
                       // isStacked: true
                       };



        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);



      }
    </script>
  </head>

  <body>
    <!--Divs that will hold the charts-->
    <div id="chart_div"></div>

  </body>
</html>

有人可以帮助我解决这个问题吗?

3 个答案:

答案 0 :(得分:0)

我建议:

  • 打开regedit->导航至 Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\(your version here:probably 14.0)\options
  • 从“文件”创建一个新的DWORD,将其命名 NoRereg,并将其值设置为1

  • 之后-您需要转到 程序和功能,并根据需要修复Excel或Office套件 关于其安装方式

  • 然后重新启动

如果您的环境中没有上述选项,则可以随时执行以下操作:

  • C:\Program Files (x86)\Microsoft Office\Office14\Excel.exe启动Excel
  • 对象克隆-将文本或击键设置到Excel窗口中以执行CTRL+O
  • 键入文件的路径名,然后按Enter

答案 1 :(得分:0)

尝试一下:

Create File "C:\Users\cxcioba\Desktop\Test.xls"
Excel: Open Spreadsheet "C:\Users\cxcioba\Desktop\Test.xls".ActiveSheet: "Default". Session: test

从您的代码中,我将更改为* .xls

答案 2 :(得分:0)

如果您尝试以这种方式打开。转到计算机中的c驱动器,然后在程序文件中查找microsoft excel。您可以在“打开程序文件”命令

中使用相同的.exe