ole

How work with Word and Excel in Delphi?

喜夏-厌秋 提交于 2019-12-24 19:17:58
问题 I use Delphi X10 and Word 2016 64-bit on Windows 10 64-bit. I always used ComObj. for example: uses ComObj; procedure TForm1.RzBitBtn1Click(Sender: TObject); var Excel: variant; i, j: word; begin Excel := CreateOleObject('Excel.Application'); Excel.Workbooks.Open('file.xls'); for i := 1 to 5 do for j := 1 to 5 do StringGrid1.Cells[j, i] := Excel.Sheets[1].Cells[i, j].Text; end; But, i want to use autocompleate for Excel methods. I read what i should import type library, but i cant find type

How can I move cursor to end of table In word application

蹲街弑〆低调 提交于 2019-12-24 16:45:59
问题 I have a Word document with 2 pages and I've insert table that table start from page one and continues until the middle of the second page(Only one table exist in document). In Delphi(XE7) and with OLE automation(variant and Office 2013), How can I move cursor after the table? (Manually in word document file, I have repeatedly press Enter key) For this purpose, These codes will not work : Selection.GoTo(wdGoToItem.wdGoToPage, wdGoToDirection.wdGoToLast); and : Selection.EndKey(wdStory,

how to check if file is opened in excel using OLE (leaves excel process open)

对着背影说爱祢 提交于 2019-12-24 12:22:13
问题 how may I check if a file is already opened in some Excel instance? I use DXL (DOORS) language but it should be independent from this language. Is there any OLE method that I can call to check which file is opened and compare that with the path/filename? and if that is possible, can I close only that worksheet/file in that Excel application? edit: this is what I got till now, this works but only once. DXL leaves an Excel.exe process open and in next checks that instance is used which has no

How to bypass the 255 char limitation in MSWord Search&Replace using OLE

浪子不回头ぞ 提交于 2019-12-24 10:44:41
问题 I am using (in a Delphi win32 application) OLE to perform search and replace in Word Documents. THe user prepares a file with some textual tags enclosing them in "{" and "}" and saves the file. Something like Dear {NAME}, I want to tell you {WHAT_I_DID_LAST_WEEK} Of course NAME and WHAT_I_DID_LAST_WEEK are DB fields that can be longer than 255. So now by using Search and replace with OLE i get a STRING PARAMETER TOO LONG error (it seems 255 is the longest string usable there). Is there an

When activating OLEControl in my PowerBuilder application, toolbar items disappear

耗尽温柔 提交于 2019-12-24 05:10:26
问题 I have created a COM Interop Control in C# to use in my PB application. If I add an ole control to my userobject and select my C# object in the painter, then an olecustomcontrol is created and everything works as expected. However, in order to use a 64-bit version of my object when building the project for a 64-bit platform (in PB Classic 12.6) I added an ole control but hit cancel when asked to select an object, so an olecontrol is created and I can use InsertClass to select my object at

C# OleDB Delete Command

ε祈祈猫儿з 提交于 2019-12-24 00:59:08
问题 I am currently creating an window application connected with a Microsoft Access database to perform CRUD operation for the business related to education One of the workflow is to search the keyword and perform CRUD operation in the DataGrid View At first , I am trying to display the datagrid view of the record ( such as students , time to take course, what course...e.t.c.) with respect to the receipt number The application logic is to get the receipt number in the datagrid View and perform

How to catch OleObject exception in Inno Setup?

时间秒杀一切 提交于 2019-12-23 12:54:31
问题 So I try to make a post request having no internet connection using next modified code: WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); WinHttpReq.Open('POST', '<your_web_server>', false); WinHttpReq.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); try WinHttpReq.Send('data'); except bla:= 'e'; finally bla := 'f'; end; Yet exception does not get catched and I get crush of my setup application with next image: How to handle OleObject exception in Inno Setup?

VBA to Prevent Keyboard Input While a Package Object (XML) is Read into ADODB Stream?

只愿长相守 提交于 2019-12-23 07:48:52
问题 I am developing an application which opens and reads an XML document previously embedded in a PowerPoint presentation, or a Word document. In order to read this object ( xmlFile as Object ) I have to do: xmlFile.OLEFormat.DoVerb 1 This opens the package object, and I have another subroutine that gets the open instance of Notepad.exe, and reads its contents in to ADODB stream. An example of this procedure is available on Google Docs: XML_Test.pptm. During this process there is a few seconds

How do I use Perl to run a macro in an **already open** Excel workbook

為{幸葍}努か 提交于 2019-12-23 05:32:52
问题 I would like to use Perl to run a macro in an already open Excel workbook. The following code works if I just want to open a workbook and run a macro: #!C:\Perl\bin\perl.exe use strict; use Win32::OLE; my $Excel = Win32::OLE->new('Excel.Application') or die; $Excel->Workbooks->open('M:\Programs\MyExcelFile.xls'); $Excel->run('Book1!ChartData'); $Excel->quit; But how do I operate on an open workbook? 回答1: Use GetActiveObject . From the docs: Here is a simple Microsoft Excel application. use

Writing cell in Excel from C++ - no value written, cell is blank

隐身守侯 提交于 2019-12-23 05:15:43
问题 When I write a cell from C++ with OLE to a cell in Excel, I get an empty cell. Whatever value is there gets overwritten to be blank. It writes in the correct cell though, so it seems the range is correct. This is my code. VARIANT arr; BSTR val = SysAllocString(L"hello excel world"); _bstr_t(val, false); arr.vt = VT_ARRAY | VT_VARIANT; SAFEARRAYBOUND sab[1]; sab[0].lLbound = 1; sab[0].cElements = 1; arr.parray = SafeArrayCreate(VT_VARIANT, 1, sab); long indices[] = {1, 1}; SafeArrayPutElement