Tag: python.net

无法访问Excel.Application()中的函数。Python 2.7 / 3.5的工作簿:“__ComObject”对象没有属性X

我正在尝试从Python脚本中使用Microsoft.Office.Interop.Excel: import msvcrt import clr clr.AddReference("Microsoft.Office.Interop.Excel") import Microsoft.Office.Interop.Excel as Excel excel = Excel.ApplicationClass() excel.Visible = True # makes the Excel application visible to the user – will use this as True for debug excel.DisplayAlerts = False # turns off Excel alerts since I don't have a handler print ("Excel: " + str(type(excel))) print ("Workbooks: " […]

用Microsoft.Office.Interop.Excel和CLR在Python中打印Excel文件?

我一直在寻找很多方法来打印excel文件,而不打开Excel应用程序 ,我在C#中使用Microsoft.Office.Interop.Excel,它工作得很好,所以我决定寻找一种方法,使其在Python中工作,我发现IronPython,但我只需要python,然后我发现pythonnet使.NET程序集在python中工作。 问题是,从源https://github.com/pythonnet/pythonnet安装它(或试图)它给了我一个关于Windows SDK找不到或错误的错误。 然后我用pip安装它,安装成功,但是当我尝试导入或添加引用时,显示另一个错误: Unable to find assembly 'Microsoft.Office.Interop.Excel'. at Python.Runtime.CLRModule.AddReference(String name) 我已经从这里下载并安装了Interop Assemblies,所以他们应该被安装。 我发现了一个在这里使用IronPython和Interop dll打印excel文件的方法。 我的主要问题是我需要打印一些Excel文件,而不打开Excel应用程序 ,如果你有另一个选项是值得欢迎的 如果没有其他select,我该怎么做才能find组件? 附加信息:用C#打印我用这个: Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application(); String CompletePath = path; Microsoft.Office.Interop.Excel.Workbook wb = excelApp.Workbooks.Open(CompletePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1]; try { // […]

Python – IronPython的困境

我开始学习Python,现在我非常喜欢它。 但是,如果你只是回答一些令我困扰的问题,而我却找不到明确的答案: 在语言兼容性方面,Python的C实现(来自python.org的主要版本)和IronPython之间有什么关系? 它是一样的语言,我通过学习一个,将能够顺利地跨过另一个,或者是Java到JavaScript? IronPython库的当前状态是什么? 它落后于CPython库多less钱? 我主要感兴趣的是numpy / scipy和f2py。 它们是否可用于IronPython? 从Python中访问VB的最好方法是什么?另一种方式是将Python的库连接到Excel的VBA上?