interop

Is there a way to programmatically add a digital signature to a VBA Macro in a word document?

半腔热情 提交于 2019-12-20 02:42:10
问题 Is there a way to programmatically add a digital signature to a VBA Macro in a word document using C# or VB.Net? There are some similar questions asked already; however, none that I could find answer my question: How to programmatically remove the digital signature from VBA macros in Excel? Digital Signature for Excel Macro 回答1: Unfortunately, there isn't an automation API for this in the VBA environment. I got it working 100% unattended (so I could use it in automated builds) by P/Invoking

How pass an decimal from c# to vb6 with Interop

别来无恙 提交于 2019-12-20 02:27:25
问题 I have an interop c# class with a property: decimal ImportoDocumento { get; set; } if i try to access to this property from vb6 a receive an error: Compiler error: Function or interface marked as restricted or the function uses an automation type not supported in visual basic. So i found this partial solution: decimal ImportoDocumento { [return: MarshalAs(UnmanagedType.Currency)] get; [param: MarshalAs(UnmanagedType.Currency)] set; } but currency supports numbers with max 4 decimals. i have

Calling a D function directly from C++

一曲冷凌霜 提交于 2019-12-20 01:38:40
问题 I've gone through http://dlang.org/cpp_interface.html and in all of the examples, even those where some C++ code calls some D code, the main function resides in D (and so the binary being called is the one compiled from the D source file). The "calling D from C++" example in the doc has a function foo defined in D, which gets called from a function bar in C++, and bar in turn gets called from the main function in D. Is it possible to just call D code from the C++ function? I'm trying to do

How to iterate and count Revisions in a Word document using C#?

谁说胖子不能爱 提交于 2019-12-20 01:37:07
问题 I have been looking around for this but couldn't find an answer anywhere, so hope aomeone here can help. I am doing a WinForms application in C# in wich i use WordApplcation.CompareDocuments to compare two documents and get a result document with the changes marked as Revisions. This works well and apart from the revisions hiding stuff inside textboxes (wich i don't care about just yet) i get exactly what i want. So next step is to count how many words got revised - specifically

Detect pivot table in Microsoft Excel using Interop c#

梦想与她 提交于 2019-12-20 01:04:43
问题 I am trying to detect whether a cell in Microsoft excel contains a Pivot Table by using Microsoft Interop c# What I want to do is loop through all of the cells as indicated in the code below, and then if the cell contains a pivot table, I want to store the row and column information of that cell in an integer value as such: int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; Excel.Range cell = null; for (int iRow = 1; iRow < rowCount; iRow++) { for (int iCol = 1; iCol <=

How to obtain the native stacktrace from native exceptions caught in managed code

柔情痞子 提交于 2019-12-19 19:55:28
问题 I have some managed code that calls to a method inside some native DLL(i have the appropriate symbol files). Sometimes, that native method throws an exception which I catch in my managed code. However, when i print the stacktrace from my caught exception, I see only managed code (the last frame is the call to the native code .. but it don't see the stacktrack within the native code). How can I obtain the native callstack as well? *When i'm debugging the code, i am able to step into the native

Using Scala class defined in package object from Java

夙愿已清 提交于 2019-12-19 19:48:16
问题 The following Scala example defines a class inside a package object: package com.mycompany package object test { class MyTest { def foo(): Int = { 42 } } } The following three classes are generated: com/mycompany/test/package.class com/mycompany/test/package$.class com/mycompany/test/package$MyTest.class The problem arises when trying to use the MyTest class from Java. I think that since package$MyTest contains a $ in the name, Java is not acknowledging its existence. Nevertheless, the

What do user-defined value classes look like from Java?

江枫思渺然 提交于 2019-12-19 16:52:09
问题 I think I understand the new "value class" feature of Scala 2.10, by comparison with Haskell's newtype : trait BoundedValue[+This] extends Any { this: This => def upperBound: This def lowerBound: This } class Probability @throws(classOf[IllegalArgumentException]) (v: Double) extends AnyVal with BoundedValue[Probability] { val value: Double = if ((v >= 0.0) && (v <= 1.0)) v else throw new IllegalArgumentException((v.toString) + "is not within the range [0.0, 1.0]") override val upperBound:

What do user-defined value classes look like from Java?

依然范特西╮ 提交于 2019-12-19 16:52:09
问题 I think I understand the new "value class" feature of Scala 2.10, by comparison with Haskell's newtype : trait BoundedValue[+This] extends Any { this: This => def upperBound: This def lowerBound: This } class Probability @throws(classOf[IllegalArgumentException]) (v: Double) extends AnyVal with BoundedValue[Probability] { val value: Double = if ((v >= 0.0) && (v <= 1.0)) v else throw new IllegalArgumentException((v.toString) + "is not within the range [0.0, 1.0]") override val upperBound:

Why is it possible to create a new instance of a COM interface?

元气小坏坏 提交于 2019-12-19 16:13:12
问题 I don't have very much background regarding COM nor coclasses, so I don't quite understand why I can use the new operator with an interface. From a language/framework-agnostic view, it's confusing why this compiles and runs correctly: using Microsoft.Office.Interop.Excel; public class ExcelProgram { static void Main(string[] args) { Application excel = new Application(); } } Inspecting Application in Visual Studio 2010 shows me: using System.Runtime.InteropServices; namespace Microsoft.Office