ole

Word Document.SaveAs ignores encoding, when calling through OLE, from Ruby or VBS

雨燕双飞 提交于 2019-12-01 07:17:15
问题 I have a script, VBS or Ruby, that saves a Word document as 'Filtered HTML', but the encoding parameter is ignored. The HTML file is always encoded in Windows-1252. I'm using Word 2007 SP3 on Windows 7 SP1. Ruby Example: require 'win32ole' word = WIN32OLE.new('Word.Application') word.visible = false word_document = word.documents.open('C:\whatever.doc') word_document.saveas({'FileName' => 'C:\whatever.html', 'FileFormat' => 10, 'Encoding' => 65001}) word_document.close() word.quit VBS Example

Importing Excel data into C# without first row becoming column names?

ぃ、小莉子 提交于 2019-12-01 06:10:07
I am trying to import data from excel into a datatable using c#. Here is the code I use to do so... string ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + "; Jet OLEDB:Engine Type=5;" + "Extended Properties=\"Excel 8.0;HRD=No;IMEX=1;\""; OleDbDataAdapter SheetAdapter = new OleDbDataAdapter("select * from ["Sheet1"]", conn); System.Data.DataTable excelData = new System.Data.DataTable(); SheetAdapter.Fill(excelData); excelData.TableName = "excelData"; foreach (DataRow row in excelData.Rows) { ProcessDataRow(row); } When I look at the datatable while debugging the

Importing Excel data into C# without first row becoming column names?

二次信任 提交于 2019-12-01 03:56:48
问题 I am trying to import data from excel into a datatable using c#. Here is the code I use to do so... string ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + "; Jet OLEDB:Engine Type=5;" + "Extended Properties=\"Excel 8.0;HRD=No;IMEX=1;\""; OleDbDataAdapter SheetAdapter = new OleDbDataAdapter("select * from ["Sheet1"]", conn); System.Data.DataTable excelData = new System.Data.DataTable(); SheetAdapter.Fill(excelData); excelData.TableName = "excelData"; foreach

Error “The object invoked has disconnected from its clients” - automate IE 8 with python and win32com

空扰寡人 提交于 2019-12-01 03:30:33
I would like to automate Internet Explorer 8 (using python 2.7 on Windows 7) machine. Here is my code after a post found on SO : import sys, time from win32com.client import WithEvents, Dispatch import pythoncom import threading stopEvent=threading.Event() class EventSink(object): def OnNavigateComplete2(self,*args): print "complete",args stopEvent.set() def waitUntilReady(ie): if ie.ReadyState!=4: while 1: print "waiting" pythoncom.PumpWaitingMessages() stopEvent.wait(.2) if stopEvent.isSet() or ie.ReadyState==4: stopEvent.clear() break; if __name__ == '__main__': time.clock() ie=Dispatch(

How to create an E-Mail in Outlook and make it visible for the User

亡梦爱人 提交于 2019-12-01 03:09:45
I want to create an E-Mail with a Java Application using Outlook and the OLE Client. I searched for examples and found quite a few. They all start the same way: Create the Display, the Shell, the OLE Frame and the OLE Client Site. But I get an error with these few steps: Display display = new Display(); Shell shell = new Shell(display); shell.setText("Outlook Automation"); shell.setLayout(new FillLayout()); OleFrame frm = new OleFrame(shell, SWT.NONE); OleClientSite site = new OleClientSite(frm, SWT.NONE, "Outlook.Application"); I get the following Error: Exception in thread "main" org.eclipse

Outlook Object Model - Detecting if email has been sent

不羁的心 提交于 2019-11-30 23:46:03
I have the following code in my test Delphi 2006 BDS application: procedure TForm1.Button1Click(Sender: TObject); const olMailItem = 0; var Outlook: OleVariant; vMailItem: variant; begin Outlook := CreateOleObject('Outlook.Application'); vMailItem := Outlook.CreateItem(olMailItem); try vMailItem.Recipients.add('anemailaddress@gmail.com'); vMailItem.Display(True); -- outlook mail message is displayed modally except end; VarClear(Outlook); end; I need to be able to detect whether the user sent the email from within the outlook screen. I tried the following code: if vMailItem.Sent then ... But

How to extract metafile from TOleContainer?

≡放荡痞女 提交于 2019-11-30 22:33:22
I have a Delphi (BDS 2006) application with TOleContainer control. It has an OLE object inside, MS Equation formula (name 'Equation.3') from MS Office 2003. How can I extract the vector metafile from the formula image to insert it into web-page or some other document without OLE support? TOleContainer has only 'Equation.3' objects inside, no other possibilities. I've tried to use .Copy method to make it through clipboard, but it's copied an empty image. OLE Container has on underlying IOLEObject interface you can access. You can pass that to the OLEDraw function with your own canvas. You could

“Unable to recognize OLE stream” excepion while connecting to Excel

ぃ、小莉子 提交于 2019-11-30 22:17:17
I was trying to connect my Java program with an Excel file. I have did upto this. But it throws this excepion Unable to recognize OLE stream Please, help me to complete this. import jxl.*; import java.io.*; public class excel { public static void main(String[] args)throws Exception { File ex=new File("D:/worksps/test.xlsx"); Workbook w= Workbook.getWorkbook(ex); Sheet s= w.getSheet(0); for(int i=0;i<s.getColumns();i++) { for(int j=0;j<s.getRows();j++) { Cell cell=s.getCell(i, j); System.out.println(" "+cell.getContents()); } System.out.println("\n"); } } } JXL supports Excel worksheets created

How to free TOleStream in this bit of code

天涯浪子 提交于 2019-11-30 21:11:38
This is from a custom namespacer handler done in Delphi I use to load files into a webbrowser component. Datastream:IStream; var F: TFileStream; Dummy: INT64; begin F:=TFileStream.Create(strfilename fmOpenRead); CreateStreamOnHGlobal(0, True, DataStream); TOleStream.Create(DataStream).CopyFrom(F, F.Size); DataStream.Seek(0, STREAM_SEEK_SET, Dummy); TotalSize := F.Size; F.Free; end; The problem is that Fastmm4 gives a memory leak error when the program ends and says that TOleStream was not freed. How do I free it? If I put TOleStream in a variable and assign like this var TOS:TOleStream; TOS:

Outlook Object Model - Detecting if email has been sent

安稳与你 提交于 2019-11-30 18:43:44
问题 I have the following code in my test Delphi 2006 BDS application: procedure TForm1.Button1Click(Sender: TObject); const olMailItem = 0; var Outlook: OleVariant; vMailItem: variant; begin Outlook := CreateOleObject('Outlook.Application'); vMailItem := Outlook.CreateItem(olMailItem); try vMailItem.Recipients.add('anemailaddress@gmail.com'); vMailItem.Display(True); -- outlook mail message is displayed modally except end; VarClear(Outlook); end; I need to be able to detect whether the user sent