<i id='FD3WC'><tr id='FD3WC'><dt id='FD3WC'><q id='FD3WC'><span id='FD3WC'><b id='FD3WC'><form id='FD3WC'><ins id='FD3WC'></ins><ul id='FD3WC'></ul><sub id='FD3WC'></sub></form><legend id='FD3WC'></legend><bdo id='FD3WC'><pre id='FD3WC'><center id='FD3WC'></center></pre></bdo></b><th id='FD3WC'></th></span></q></dt></tr></i><div id='FD3WC'><tfoot id='FD3WC'></tfoot><dl id='FD3WC'><fieldset id='FD3WC'></fieldset></dl></div>
<tfoot id='FD3WC'></tfoot>

    1. <legend id='FD3WC'><style id='FD3WC'><dir id='FD3WC'><q id='FD3WC'></q></dir></style></legend>

          <bdo id='FD3WC'></bdo><ul id='FD3WC'></ul>

        <small id='FD3WC'></small><noframes id='FD3WC'>

      1. 有没有更好的方法(除了COM)来远程控制Excel?

        时间:2023-07-24
        <i id='SeKiq'><tr id='SeKiq'><dt id='SeKiq'><q id='SeKiq'><span id='SeKiq'><b id='SeKiq'><form id='SeKiq'><ins id='SeKiq'></ins><ul id='SeKiq'></ul><sub id='SeKiq'></sub></form><legend id='SeKiq'></legend><bdo id='SeKiq'><pre id='SeKiq'><center id='SeKiq'></center></pre></bdo></b><th id='SeKiq'></th></span></q></dt></tr></i><div id='SeKiq'><tfoot id='SeKiq'></tfoot><dl id='SeKiq'><fieldset id='SeKiq'></fieldset></dl></div>
          <bdo id='SeKiq'></bdo><ul id='SeKiq'></ul>
          <tfoot id='SeKiq'></tfoot>

          <small id='SeKiq'></small><noframes id='SeKiq'>

              • <legend id='SeKiq'><style id='SeKiq'><dir id='SeKiq'><q id='SeKiq'></q></dir></style></legend>
                  <tbody id='SeKiq'></tbody>
                1. 本文介绍了有没有更好的方法(除了COM)来远程控制Excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一种回归测试工具,该工具将验证大量 Excel 电子表格.目前,我使用最新版本的 pywin32 产品通过 Python 脚本通过 COM 控制它们.不幸的是,COM 似乎有许多恼人的缺点:

                  I'm working on a regression-testing tool that will validate a very large number of Excel spreadsheets. At the moment I control them via COM from a Python script using the latest version of the pywin32 product. Unfortunately COM seems to have a number of annoying drawbacks:

                  例如,最轻微的干扰似乎能够断开与 COM-Server 的连接,一旦断开,似乎没有安全的方法可以重新连接到 Excel 应用程序.COM 应用程序对象中绝对没有内置安全性.

                  For example, the slightest upset seems to be able to break the connection to the COM-Server, once severed there seems to be no safe way to re-connect to the Excel application. There's absolutely no safety built into the COM Application object.

                  Excel COM 接口不允许我安全地远程控制在同一个工作簿文件上运行的 Excel 应用程序的两个单独实例,即使它们是只读的.

                  The Excel COM interface will not allow me to safely remote-control two seperate instances of the Excel application operating on the same workbook file, even if they are read-only.

                  此外,当确实出现问题时,我很少收到任何有用的错误消息……最多只能是数字错误代码或几乎没有用的消息,例如发生异常".几乎不可能知道为什么会出错.

                  Also when something does go wrong I seldom get any useful error-messages... at best I can except a numerical error-code or a barely useful message such as "An Exception has occurred". It's almost impossible to know why something went wrong.

                  最后,COM 缺乏控制 Excel 一些最基本方面的能力?例如,没有办法保证只关闭 COM 客户端所连接的 Excel 进程.你甚至不能使用 COM 来查找 Excel 的 PID.

                  Finally, COM lacks the ability to control some of the most fundamental aspects of Excel? For example there's no way to do a guaranteed close of just the Excel process that a COM client is connected to. You cannot even use COM to find Excel's PID.

                  如果我完全放弃 COM 怎么办? 是否有其他方法来控制 Excel?

                  So what if I were to completely abandon COM? Is there an alternative way to control Excel?

                  我只想运行宏、打开和关闭工作簿以及读取和写入单元格范围?也许一些 .NET 专家知道一两个还没有进入 Python 社区的技巧?你们办公室的黑客呢?有没有比 COM 更好的方法来了解 Excel 的内脏?

                  All I want to do is run macros, open and close workbooks and read and write cell-ranges? Perhaps some .NET experts know a trick or two which have not yet bubbled into the Python community? What about you office-hackers? Could there be a better way to get at Excel's innards than COM?

                  推荐答案

                  没有办法完全绕过COM.您可以使用 VSTO(Visual Studio Tools for Office),它在 COM 对象上有很好的 .NET 包装器,但它在下面仍然是 COM.

                  There is no way that completely bypasses COM. You can use VSTO (Visual Studio Tools for Office), which has nice .NET wrappers on the COM objects, but it is still COM underneath.

                  这篇关于有没有更好的方法(除了COM)来远程控制Excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:COM 互操作对象在一个项目中引发 InvalidCastException,但在其他项目中不引发 下一篇:MSHTML HTMLHeadElementClass COM 错误

                  相关文章

                        <bdo id='NJTlh'></bdo><ul id='NJTlh'></ul>

                      <legend id='NJTlh'><style id='NJTlh'><dir id='NJTlh'><q id='NJTlh'></q></dir></style></legend>

                    1. <small id='NJTlh'></small><noframes id='NJTlh'>

                      <tfoot id='NJTlh'></tfoot>
                      <i id='NJTlh'><tr id='NJTlh'><dt id='NJTlh'><q id='NJTlh'><span id='NJTlh'><b id='NJTlh'><form id='NJTlh'><ins id='NJTlh'></ins><ul id='NJTlh'></ul><sub id='NJTlh'></sub></form><legend id='NJTlh'></legend><bdo id='NJTlh'><pre id='NJTlh'><center id='NJTlh'></center></pre></bdo></b><th id='NJTlh'></th></span></q></dt></tr></i><div id='NJTlh'><tfoot id='NJTlh'></tfoot><dl id='NJTlh'><fieldset id='NJTlh'></fieldset></dl></div>