interop

Determine if a Word cell is merged

落花浮王杯 提交于 2019-12-02 00:53:13
I need to programmatically add and remove rows from a Word 2010 table. Unfortunately the header of the table contains merged cells, both horizontally and vertically merged. That causes an error when using the Row.Add and Row.Delete methods. I have tested and discovered that I can programmically remove the merged cells (Cell.Split) and then do the .Add and .Delete methods and then restore the merged cells. The problem I'm having is identifying which cells that are merged. ------------------------- | 1,1 | 1,2 | 1,3 | 1,4 | ------------------------- | 2,1 | 2,2 | 2,3 | 2,4 | --------------------

help: Call C# winforms dll from VB6 project?

守給你的承諾、 提交于 2019-12-01 23:35:21
I have a VB6 project(windows application) and I have to redevelop a module in the existing VB6 project in C#.net. The module that I develop in C#.net should be a dll and should contain some windows forms. I was able to successfully call a c# console applicaiton dll from my vb6 project but I am facing issues when i try to call a C# class library with winforms from my VB6 project. This is what I have done for my Proof Of Concept - This is a class file in my C#.net class library project. namespace TestDll { public interface IClass1 { void DisplayMessage(); } public class Class1:IClass1 { void

80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))

跟風遠走 提交于 2019-12-01 23:33:51
Retrieving the COM class factory for component with CLSID {0A80A563-28AE-11D3-9CD6-00C04F8B8EF1} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)) I've Searched for the entry in Registry I can Find Assembly with {0A80A563-28AE-11D3-9CD6-00C04F8B8EF1} at HKLM\Software\Classes\Wow6432Node\CLSID{0A80A563-28AE-11D3-9CD6-00C04F8B8EF1}\InProcServer32 I've Created Application By using embedded interop types it is working fine in the Local Machine but when i deploy it to another Server it gives the

Casting Range.Value2 of Excel interop to string

ⅰ亾dé卋堺 提交于 2019-12-01 22:47:52
I import some values from Excel sheets in C# application. One column is a text basically but can contain any values. I used the following: Range range = ... // getting this from Excel, works fine string myString = (string)range.Value2; When the cell contains text, this is working. But when it contains, for example, 123, the debugger shows 123.0 for range.Value2 and conversion to string fails with exception. I wonder, how to write the most general conversion for all kinds of cells. At least string and integer, may be float content. I found the solution which may be not so nice but works:

How can I see if a Word-file is password-protected?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 22:19:12
问题 I am maintaing an archiving system that has to convert various kinds of document formats to tif. My problem is with password-protected Word-documents. If the document is password-protected, then Word responds with a popup asking me to enter the password. It's ok if the document is password-protected if I can just tell the customer that he needs to do something about it. The problem is that I programmatically cannot register if Word is prompting for a password. The code below is the standard

IMAPI2 MsftFileSystemImage in .NET not releasing files when creating ISO

只谈情不闲聊 提交于 2019-12-01 21:46:55
问题 I succesfully create the iso image, but I get 'file in use' IO errors trying to delete files in the rootFolderPath after returning from calling this Create method. Am I missing a Marshal.ReleaseComObject call? thanks, cw /// <summary> /// Create iso image from rootFolderPath and write to isoImageFilePath. Does not include the actual rootFolder itself /// </summary> public void Create() { IFileSystemImage ifsi = new MsftFileSystemImage(); try { ifsi.ChooseImageDefaultsForMediaType(IMAPI_MEDIA

What is a String[*] and how do I cast it?

旧时模样 提交于 2019-12-01 21:46:35
问题 I'm currently in the unfortunate position of having to call a VBA macro from C#, via the COM Interop. The macro returns an array of strings and looks something like: Public Function Foo() As String() which I'm then trying to cast to an array of strings in C# like this: var result = (string[])xlApp.Run("Foo", ... missing args ...) which then results in the runtime error: Unable to cast object of type 'System.String[*]' to type 'System.String[]'. Does anyone know what a String[*] is, and do you

This command requires at least two rows of source data

人盡茶涼 提交于 2019-12-01 21:35:54
I am getting this error: This command requires at least two rows of source data. You cannot use the command on a selection in only one row. Try the following: - If you're using an advanced filter, select a range of cells that contains at least two rows of data. Then click the Advanced Filter command again. - I you're creating a PivotTable, type a cell reference or select a range that includes at least two rows of data intermittently on this line of code: xlWorkBook.RefreshAll(); There are two worksheets. One has a pivot table and one has raw data. Sometimes there is only one row of data. For

IMAPI2 MsftFileSystemImage in .NET not releasing files when creating ISO

吃可爱长大的小学妹 提交于 2019-12-01 21:11:48
I succesfully create the iso image, but I get 'file in use' IO errors trying to delete files in the rootFolderPath after returning from calling this Create method. Am I missing a Marshal.ReleaseComObject call? thanks, cw /// <summary> /// Create iso image from rootFolderPath and write to isoImageFilePath. Does not include the actual rootFolder itself /// </summary> public void Create() { IFileSystemImage ifsi = new MsftFileSystemImage(); try { ifsi.ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK); ifsi.FileSystemsToCreate = FsiFileSystems.FsiFileSystemJoliet |

BadImageFormatException encountered with WcfSvcHost and IIS WCF host

白昼怎懂夜的黑 提交于 2019-12-01 20:49:37
Creating a WCF Service Library in Visual Studio 2008 on Vista x64 is troublesome when referencing an x86 DLL. A service that calls a 32-bit DLL is required to have a platform target of x86 to run on a 64-bit OS. When you do this, the WcfSvcHost throws a BadImageFormatException when you attempt to debug the service. There is a bug report on MS connect. The workaround I used was to coreflag WcfSvcHost as 32-bit . Manifest Problem The main issue I've run in to is this third-party native 32-bit DLL fails to load using certain WCF hosts. I receive the following error when a service operation is