Tag: Office办公室

启用由Excel / PPT禁用的内置Officefunction区button

这是很好地logging如何在Microsoft Office内置的function区button可以重新用途( 例如这里 ),例如复制button。 但是,我并不知道有任何方法可以完全控制重新使用的内置控件的启用状态。 对我来说,这是一个问题,因为我想在Excel和PowerPoint中实现一些扩展function,在某些情况下,alignmentbutton是有意义的。 但它们被Excel / PowerPoint禁用,所以重新调整它们不起作用。 禁用默认启用的内置button不是问题。 为内置button定义一个getEnabledcallback函数似乎可以解决问题。 但是如何启用默认禁用的内置function区button? (getEnabled在这里没有帮助) 我怀疑没有“VBA / VSTO方式”来完成任务? 你认为有可能使用COM,例如通过IAccessible? 到目前为止,我只find枚举,select和调用button命令的方法,但不能改变它们的状态。

无法在控制台应用程序中写入或读取Worksheet.CustomProperties

在我的控制台应用程序中,我试图写一些东西,并从Excel工作表的CustomProperties中读回来。 我有一个参考Microsoft.Office.Interop.Excel v14程序集。 在调用firstWorksheet.CustomProperties.Add方法的行firstWorksheet.CustomProperties.Add ,我得到一个HRESULT 0x800A03ECexception。 以下是相关的代码位: static void WriteToExcelCustomDocumentProperties( string excelFile, string outputFolder, string propertyName, object propertyValue) { excel::Application excel = null; Workbook workbook = null; Worksheet firstWorksheet = null; try { excel = new excel::Application(); workbook = excel.Workbooks.Open(excelFile); firstWorksheet = workbook.Worksheets[1] as Worksheet; firstWorksheet.CustomProperties.Add(propertyName, propertyValue); var outputFilePath = GetOutputFilePath(excelFile, outputFolder); workbook.SaveAs(outputFilePath); } catch(Exception […]

加载32位COM DLL在64位办公室插件

我想实现一件事情。 我想使用Excel Add的32位COMtypes库。请注意,我的机器上安装了64位的Excel 2010。 我已经编译了32位的join。 但是,当我创build一个COM类的实例,它给出了这个错误“检索COM类工厂的组件与CLSID失败,由于以下错误类未注册”是否有可能是我想要做的? 任何build议(使用其他版本的Excel或1 64位COMtypes库除外)?

Python:无需剪贴板,从Office / Excel文档访问embedded的OLE

我想使用Python添加和提取Office / Excel文档中的文件。 到目前为止,添加东西很容易,但是对于解压缩我还没有find一个干净的解 为了清楚我已经得到了什么,以及我已经写了下面的小例子test.py ,并进一步解释。 test.py import win32com.client as win32 import os from tkinter import messagebox import win32clipboard # (0) Setup dir_path = os.path.dirname(os.path.realpath(__file__)) print(dir_path) excel = win32.gencache.EnsureDispatch('Excel.Application') wb = excel.Workbooks.Open(dir_path + "\\" + "test_excel.xlsx") ws = wb.Worksheets.Item(1) objs = ws.OLEObjects() # (1) Embed file f = dir_path + "\\" + "test_txt.txt" name = […]