interop

Exporting data to excel file C#.NET

狂风中的少年 提交于 2019-12-12 20:27:15
问题 I want to export the data from a access database to excel file. But i got Exception from HRESULT: 0x800A03EC error. Here is a bit of code that i have written, using System; using System.Data; using System.Data.OleDb; using System.Configuration; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; using Excel = Microsoft.Office.Interop.Excel; private void showBtn_Click(object sender, EventArgs e) { int cnt = -1;

PowerPoint Interop Assemblies Slowness Issue

随声附和 提交于 2019-12-12 19:13:40
问题 I'm using MS Office interop assemblies to build a Powerpoint addin that inserts slides and charts on the fly. But during insertion it take up to 20 seconds to complete the process from inserting the slide to insertion of the chart. After doing extensive logging, I noticed few lines of code where our application gets stuck for 20+ seconds. Here are those lines: powerpointChartObj.SetSourceData(Source:=String.Format("=Sheet1!A1:B{0}", 5)) powerpointSlideObject.Shapes("some shape name") We

ClipboardInterop content changed fires twice

亡梦爱人 提交于 2019-12-12 18:36:07
问题 I am writing a WPF application which monitors Clipboard changes. I wrote the following class: public class ClipboardInterop : IDisposable { public event EventHandler ClipboardContentChanged; private void OnClipboardContentChanged() { var handlers = ClipboardContentChanged; if (handlers != null) { handlers(this, new EventArgs()); } } public static ClipboardInterop GetClipboardInterop(Window window) { var hwndSource = PresentationSource.FromVisual(window) as HwndSource; if (hwndSource == null)

How to convert IPictureDisp to System.Drawing.Image

房东的猫 提交于 2019-12-12 18:24:31
问题 From a COM library (Microsoft Office Document Imaging aka MODI) I receive an image as an IPictureDisp which I would like to convert to a System.Drawing.Image object. What would be the best way to do that? Currently I'm using the code below, which however throws an NotImplementedException. internal sealed class IPictureDispHost : AxHost { /// <summary> /// Default Constructor, required by the framework. /// </summary> private IPictureDispHost() : base(string.Empty) { } /// <summary> ///

Sending a C# string as an argument to a unmanaged C++ DLL function

泪湿孤枕 提交于 2019-12-12 16:41:25
问题 I want to send my C# string to a C++ DLL function. I have succeeded, both with StringBuilder: [C#] public static extern int installHook(StringBuilder directory); StringBuilder myText = new StringBuilder(512); myfunc(myText); [C++] int OPENGLHOOK_API myfunc(char* directory) { ::MessageBoxA(NULL,directory,"test123",0); } and with a simple string & wchar: [C#] public static extern int installHook(string directory); myfunc("myText"); [C++] int OPENGLHOOK_API installHook(wchar* directory) {

C# Interop Non-invocable member 'Microsoft.Office.Interop.Excel.Range.End' cannot be used like a method

五迷三道 提交于 2019-12-12 16:23:50
问题 I'm using C# Interop to get some values from a Worksheet and I get the following error: Non-invocable member 'Microsoft.Office.Interop.Excel.Range.End' cannot be used like a method. This is my code: var wb = (Excel.Workbook)Globals.ThisAddIn.Application.ActiveWorkbook; var wsEvars = wb.Sheets["Evars"]; var wsProps = wb.Sheets["Props"]; var wsEvents = wb.Sheets["Events"]; var wsListVars = wb.Sheets["List Vars"]; var sheetList = new Excel.Worksheet[] { wsEvars, wsProps, wsEvents, wsListVars };

Leiningen compiling error with Java files that reference classes generated from Clojure files

纵饮孤独 提交于 2019-12-12 15:28:34
问题 I have a Leiningen project that is compiling both Java and Clojure files. The Java files import some of the classes that are generated from the Clojure files (with gen-class). When I do lein compile, I get compilation errors on the imports in the Java files (saying it can't find the classes). If I remove the Java files from the project, do lein compile, add the Java files back, and do lein compile again, everything works fine. So, it's like the Clojure files need to be compiled before the

C# - C interoperability

偶尔善良 提交于 2019-12-12 14:53:38
问题 The Q/A at link text gets very close to what I'm looking for, but I'm just starting on C# and need a bit more filled in and possibly some hints about the best way to proceed. I've got an app I've written for the PalmPre/webOS in Javascript and a piece of it is written in C for portability, not for performance. It does Lear Jet performance calculations. In the webOS world, the C code (plugin) goes in its own process and there's a way for JS to invoke and invoke the C code (using 'main') to

How can i invoke a during compiletime unknown native function from C#

。_饼干妹妹 提交于 2019-12-12 14:34:21
问题 During runtime i am supplied with a String name, a sorted array of objects and some additional information about a native function (dllpath, calltype, etc). lets assume all information was in a CallInformation Object. How can i call this native function? note: - i am not supplied with the dll before runtime. - i am not supplied with the call information before runtime. - i dont know the ammount or types of call parameter before runtime. - i dont know the returntype before runtime. The usual

Word 2010 Interop PDF Export missing border line

扶醉桌前 提交于 2019-12-12 14:06:25
问题 I have a strange issue ... I am using Word 2010 Interop, exporting a WordML document to PDF. There is a footer with top and bottom lines: <w:pBdr> <w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="auto"/> <w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="auto"/> </w:pBdr> After opening document I use doc.ExportAsFixedFormat( outputFileName.ToString(), exportFormat, openAfterExport, optimizeFor, range, 0, 0, item, includeDocProps, keepIRM,