interop

Export bitmap image from Excel cells

一世执手 提交于 2019-12-11 08:00:04
问题 I have created an .xlsx file using the OpenXML framework and I am embedding it into a PowerPoint slide (also created using OpenXML) the problem is that I need a placeholder image for the OleObject the Excel sits in on the PowerPoint slide - i can use a standard placeholder, but this looks bad. So I was hoping (most likely using Interop) to find a way of opening the .xlsx file and exporting the relevant cells as a bitmap (.jpg or .png ideally) which I can then feed into my OleObject as the

How to set the text in a TextBox control from native code?

不羁的心 提交于 2019-12-11 07:44:47
问题 Is it possible to manipulate .net controls from native code? Particularly, I'd like to set the text of a TextBox from some native code. I want it done this way to keep the business logic separated from the user interface, but it is precisely the native code which only knows how to appropriately format the data (some bytes received within a protocol). I know I could get the window handle through the Handle property, but once there, how would I call the desired method? Is string handling my

Looping over Outlook mail items in “Sent Items” folder

六月ゝ 毕业季﹏ 提交于 2019-12-11 07:33:53
问题 We're trying to access the Sent Items folder in Outlook 2007 (using Exchange) but the test for TypeOf(i) Is Outlook.MailItem in the below code snippet always returns False. We know we have the right folder because a test for items.Count returns the correct number of mail items. Inbox messages are fine. If we change the folder from olFolderSentMail to olFolderInbox the test for TypeOf(i) Is Outlook.MailItem passes and it's quite happy to show us the Subject. Dim app As Outlook.Application =

Writing C# managed code in native C++

狂风中的少年 提交于 2019-12-11 07:31:02
问题 I am developing a managed lib (using Microsoft Web Services) and I am including it into a c++ project. The project doesn't use /clr option, so when I include my library's header file VS2005 show me an error saying I have to use /clr option. Doing this I have a incompatibility with /EHs command line option (error D8016), but changing from EHs to no exception handling not solving problem and keep showing me same error . Any suggestion is welcome. Thank you in advance. 回答1: If you have unmanaged

Passing an array from managed code to unmanaged C++ ActiveX component

别等时光非礼了梦想. 提交于 2019-12-11 07:21:18
问题 In an earlier post Passing pointer from managed C++/CLI to ActiveX C++ component I've asked about the correct means to pass an array (whether managed or unmanaged array) to an activeX component created in native C++. The activeX method has the following signature: short Component::CopyToBuffer(short FAR* ptr) {} when the activeX is imported to be used in C++/CLI the method signature is displayed as short Component::CopyToBuffer(short% ptr) {} when imported in C# it is displayed as short

Run Access Queries via Interop?

大城市里の小女人 提交于 2019-12-11 06:56:07
问题 I have a few MS-Access queries in several *.mdb files. They are quite complex. So I just want to open a file, run specific queries which it contains and get a resulting table back. How can I do that ? (I know we can just connect via connection string etc. but I want to explore this way.) My sample code (edited to disable security alerts): using Microsoft.Office.Interop.Access; using Microsoft.Office.Core; var app = new Application(); app.OpenCurrentDatabase(@"C:\test.mdb", true); app

Entlib and interop: does it work, and where does the config file go?

↘锁芯ラ 提交于 2019-12-11 06:53:46
问题 I'm trying to use the EntLib 3.1 within .net code for a dll which is registered for COM interop. Where do I put the config file? Alternatively, is there a way to specify within the dll code where it should get the entlib config from? Since my dll will be called from COM I don't always know what exe will be calling it. I created a simple app which uses entlib Logging, with two classes: 'CallingApp' and 'MyComThing'. When I call a method of MyComThing from CallingApp it logs using the

How-to: Remove text from Word document footer using C#

纵然是瞬间 提交于 2019-12-11 06:51:47
问题 I'm trying to remove a footer from a Word document using C# 4. The footer looks like this: Page 1 April 18, 2012 Actually, this the text for the footer when displayed in Word VBA: Page 1 ( April 18, 2012 There's actually a bullet character between "Page 1" and "April". In the end the footer should look like this: April 18, 2012 Anyway, in Word VBA, I'm able to do it using this code: Dim rngFtr As Range Set rngFtr = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range rngFtr

Need to run unit tests on a custom class that is heavely dependant on Office.Interop (COM) classes

◇◆丶佛笑我妖孽 提交于 2019-12-11 06:29:38
问题 I have a class called ExcelManager that is responsible for taking a path to an excel file in its constructor and has a method that takes a Sheet Name as a string or Sheet Index as an int, it then parses the data on that sheet minus headers and builds and returns a DataTable. I have written integration tests that successfully test most of the ExcelManager class however they can only run on a system that has Excel installed. What I am looking to do is either break down the ExcelManager class so

Send keys to WPF Browser control

牧云@^-^@ 提交于 2019-12-11 06:19:45
问题 Can I programatically send [UserID]{TAB}[Password]{CARRIAGE RETURN} to a webbrowser control which has a userID, password and Sign-in button there. I wanted to use my own virtual keyboard in my application. Any tips here? 回答1: Sorry for the late answer but I've just finished a similar project and as part of the work am in the process of open sourcing two projects to Codeplex. The first is the Windows Input Simulator which is a simple .NET wrapper around the Win32 SendInput written in C#. The