ole

How to extract the contents of an OLE container?

你。 提交于 2019-12-05 10:32:08
I need to break open a MS Word file (.doc) and extract its constituent files ('[1]CompObj', 'WordDocument' etc). Something like 7-zip can be used to do this manually but I need to do this programatically. I've gathered that a Word document is an OLE container (hence why 7-zip can be used to view its contents) but I can't work out how to (using C++): open the OLE container extract each constituent file and save it to disk I've found a couple of examples of OLE automation (eg here ) but what I want to do seems to be less common and I've found no specific examples. If anyone has any idea of

execute multiple update command on Excel

不打扰是莪最后的温柔 提交于 2019-12-05 07:03:16
I have an Excel file and I want update multiple rows in a sheet.So I write this code : OleDbConnection cn = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + serverPath + ";Extended Properties = Excel 8.0;"); try { strUpd = ""; strUpd += "update [Data14City$] set B_1_1 = 5 ,B_1_2 = 26 ,B_1_3 = 44 ,B_1_4 = 8 where id = 1 "; strUpd += " update [Data14City$] set B_1_1 = 0 ,B_1_2 = 8 ,B_1_3 = 17 ,B_1_4 = 0 where id = 2"; cn.Open(); OleDbCommand cmdInsert = new OleDbCommand(strUpd, cn); cmdInsert.ExecuteNonQuery(); cn.Close(); } catch { } and I got this error: Syntax error

Python: Access embedded OLE from Office/Excel document without clipboard

我怕爱的太早我们不能终老 提交于 2019-12-05 03:00:41
I want to add and extract files from an Office/Excel document using Python. So far adding things is easy but for extracting I haven't found a clean solution. To make clear what I've got and what not I've written the small example test.py below and explain further. 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)

How to do a simple mail merge in OpenOffice

混江龙づ霸主 提交于 2019-12-05 01:52:07
问题 I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net or C# via OLE or native API. Are there any good examples available? 回答1: I haven't come up with a solution I'm really happy with but here are some notes: Q. What is the OO API for mail merge? A. http://api.openoffice.org/docs/common/ref/com/sun/star/text/MailMerge.html Q. What support groups? A. http://user.services.openoffice.org/en/forum/viewforum.php?f=20 Q. Sample code? A. http://user.services.openoffice.org/en

Set OLE Request Timeout from C++

自闭症网瘾萝莉.ら 提交于 2019-12-04 23:05:52
问题 I am instantiating a local COM server using CoCreateInstance. Sometimes the application providing the server takes a long time to start. When this happens, Windows pops a dialog box like this: Server Busy The action cannot be completed because the other program is busy. Choose 'Switch To' to activate the busy program and correct the problem. [Switch To...] [Retry] [Cancel] I have found mention of a Visual Basic property on the Application object, OleRequestPendingTimeout, that can be used to

How can I load another new Word document in the same Word window?

对着背影说爱祢 提交于 2019-12-04 19:21:17
It seems that in the Microsoft Word object model, a Word document is bound to a Window, but I want to close the existing document and open a new one without closing the Word window. How can I do this? This works for me to close a document and open a document in the same window (I'm running the macro from normal.dotm ): Sub CloseOpenSameWindow() Dim d As Document: Set d = ActiveDocument Application.ScreenUpdating = False d.Close Application.Documents.Add Template:="C:\Users\Me\Desktop\Mydocument.docx" Application.ScreenUpdating = True End Sub Have you tried File->Close ? That should close the

Embed SWT Composite into C# application

依然范特西╮ 提交于 2019-12-04 14:16:05
问题 I've got a Java application that uses SWT as its widget toolkit. I've also got a Windows C# application. I'd like a way to draw an SWT Composite into this C# application. I can think of two ways to do this: Handles: Since SWT is based on the native windowing toolkit, it seems like there should be a way to create a Composite in the C# application, pass the native pointer to the Java application, and then control the Composite from there. OLE: Since SWT can definitely consume OLE components,

Save an embedded Word document in an Excel spreadsheet to disk using VBA

无人久伴 提交于 2019-12-04 13:47:13
We have a Excel spreadsheet that currently generates a report using a Word template stored on the company LAN. This works fine for internal users but not for anyone not connected to the LAN e.g. laptop users. Management does not want to distribute the template as a seperate file to external users but would prefer to embed this into the spreadsheet on a hidden worksheet. It is then proposed that when generating a report that the embedded template would then be saved to the users temp path and the report generated from there. My question then, is how can i save the embedded Word template to disk

Could not convert variant of type (Null) into type (OleStr)

前提是你 提交于 2019-12-04 11:51:49
问题 Do you know why the block of code bellow will negate the "Could not convert variant of type (Null) into type (OleStr)" on some computers, not all of them but 3 out of ten computers generate the error message. function GetWMIstringSW(const WMIClass, WMIProperty:string): string; const wbemFlagForwardOnly = $00000020; var FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; LNode : TTreeNode; LNode2 : TTreeNode; begin Result:=''; FWbemObjectSet:=

From C#, open an arbitrary application

情到浓时终转凉″ 提交于 2019-12-04 11:30:53
Related question [stackoverflow] here . I'm trying to do the above, but I want to take the process one step further. I want to open an arbitrary file using the default editor for the file type. From that point, I want to allow my user to interact with the file as they would normally, or continue to work in my application. The extension is what happens after the user finishes editing. Is there a way I can capture a close (and ideally save) event from the external application and use that as a trigger to do something else? For my purposes, tracking the closing of the external application would