|
Hey guys
My situation:
I started playing around with the excel object library in c# and became a bit confused when an error occured while trying to set the value of a specific range.
First I wanted to use a 2-dimensional array to fill the sheet with data in one step. But I had to break it down to more little parts (inserting row for row) in order to track down the source of this strange error.
When inserting row for row, i noticed some of them being inserted well and others were not.
The difference between the rows which were inserted without any error and those who weren't is the length of some strings which consist of more than 911 characters.
I already found out that inserting the single value into the cell works fine but as soon as i use an array to fill the sheet, it does not work anymore.
Now (and finally ) my question:
Is there any way to fill a excel sheet with a 2-dimensional array which contains strings longer than 911 chars with the set_Value method of a range object?
And if not - do you know any kind of workaround except for truncating the string to 911 chars?
Google wasn't very helpful (or i did not search for the right subject) and i just found some fellows having the same problem without any solution...
Thanks in advance,
mik
//edit:
I spent some more time in searching for a solution and found the following knowledge base article:
You may receive a "Run-time error 1004" error message when you programmatically set a large array string to a range in Excel 2003
I really don't want to believe that this actually is THE workaround - i even think its not a workaround at all. I would be glad to see a real workaround for this problem...
//second edit:
After googling like i never did before i found a google group post where a nice guy describes how to read a adodb recordset and fill the excel sheet with its data by using a QueryTable object. You also can use this to parse (tab-seperated) textfiles.
Here's the link - just check out the MSDN documentation for the different classes if you dont understand something (though QueryTable Class is barely documented...) -
Fill a Excelsheet with a QueryTable to work around the 911 character limitation
-- modified at 10:44 Monday 9th October, 2006
|
|
|
|
|
I'd activex control, having certain set of functions. Recently, I've added a new function to it, which i intend to exposed,
BEGIN_DISPATCH_MAP(CMyCtrl, COleControl)
DISP_FUNCTION(CMyCtrl, "fun1", fun1, VT_EMPTY, VTS_I4 VTS_I4)
DISP_FUNCTION(CMyCtrl, "newfunction", newfunction, VT_EMPTY, VTS_VARIANT)
END_DISPATCH_MAP()
I use this control at client code, using COledispatchDriver.
But problem is, now call to new function throws exception. i.e. it doesn't recognizes new function. COledispatchDriver is not able to invoke newly added function. I've registed changed activex.
Does anybody faced similar problem?
|
|
|
|
|
You have to re-import the ActiveX. Otherwise the classwizard generated wrapper class for your interface won't contain the new interface function.
By registering the component you simply add information to the registry, e.g. where the typelib for the component can be found. The registration procedure does not magically change any code in your client.
Of course you can "manually" add the new interface function to your client's interface wrapper class without re-importing the component. Have a look at how "funl" is handled and you should be able to figure it out. Just be careful to get the dispid and the argument list correct.
Hope this helps
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Hi Roger,
I'm not importing ocx, as you mentioned.
I'm using Coledispatchdriver class instead. By some efforts, I found that, the problem occurs on m/c , having this activex installed previously(old version, without new function). In that case, after registration, new value named InprocServer32 (its not key), is stored under key InprocServer32 . Which contains some garbage.
If I delete that value, it works fine .
Still cant figure out problem.
thanks for your concern.
|
|
|
|
|
Sorry Prasad, I cannot figure that one out. At least not right now.
But I must say I don't really get your problem...
1. You have an older version of the ActiveX without the new function that works fine.
2. When you register the newer version it adds the InprocServer32 value below the InprocServer32 key and fills it with "garbage".
3. If you delete the InprocServer32 value, the new version works fine.
Is this correctly understood?
What happens if you unregister the previous version before registering the new?
Is the "garbage" a MULTI_SZ similar to the same value for the "Microsoft ProgressBar Control, version 6.0" (CLSID = {35053A22-8589-11D1-B16A-00C0F0283628})?
What happens if you change the contents of the InprocServer32 value instead of deleting it? Error messages when trying to create the server?
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger Stoltz wrote: 1. You have an older version of the ActiveX without the new function that works fine.
2. When you register the newer version it adds the InprocServer32 value below the InprocServer32 key and fills it with "garbage".
3. If you delete the InprocServer32 value, the new version works fine.
Is this correctly understood?
exactly.
Roger Stoltz wrote: What happens if you unregister the previous version before registering the new?
No success.
Roger Stoltz wrote: Is the "garbage" a MULTI_SZ similar to the same value for the "Microsoft ProgressBar Control, version 6.0" (CLSID = {35053A22-8589-11D1-B16A-00C0F0283628})?
yes, its similar to it.
Roger Stoltz wrote: What happens if you change the contents of the InprocServer32 value instead of deleting it?
Haven't tried it. But , as mentioned earlier, deleting it was the solution( obviosly, cant ask user to do that , i.e. to play registry).
I tried to access added function from activex control test container. I can see it in list. But again show no effect on pressing invoke. Same thing happen when tried to access new function in vb code. Intellisense shows added function. But in run , error comes, telling 'object doesn't support this property/method'.
thanks.
|
|
|
|
|
The InprocServer32 key's default value is always the path to the library containing the server, but I haven't seen the value with the same name before.
So: I've google'd around trying to get some information about this mysterious InprocServer32 value.
It turns out that the most usual usage of this value is by installing the server with InstallShield and provides some kind of support for update service.
I have to dig deeper to get more out of it, but perhaps I don't have to...
Now to the obvious question: are you at some point using and/or registering InstallShield, or any external installer...? Or am I barking up the wrong tree?
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger Stoltz wrote: are you at some point using and/or registering InstallShield, or any external installer...?
No I'm just using regsvr32 commandline.
|
|
|
|
|
I found this[^] KB article at InstallShield's site.
It seems like it is the "Microsoft Windows Installer Service" that uses this registry value on "recent" platforms, i.e. w2k and later.
Since you're simply registering the server through command line, I suspect you're building the server with a MSVC version greater than 6.0 and the registration of this value is burried somewhere in the framework. Usually I'm working with MSVC6 so I'm not that familiar with later versions.
If you put a breakpoint inside the server's DllRegisterServer you should get to the code that registers this value...eventually.
Doesn't sound like much fun though. I think it would make sense if you could disable this feature somewhere in the call chain of DllRegisterServer.
BTW, are you able to call any other interface function of your server successfully?
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Thanks for information, Roger.
|
|
|
|
|
Roger Stoltz wrote: BTW, are you able to call any other interface function of your server successfully?
--
Yes, I can call old server functions succesfully.
|
|
|
|
|
I have an application that uses COM+ and on some machines i get crashes ... The only error message is the standard windows error message and it gives me this
Faulting application application.exe, version 1.0.0.1, faulting module ole32.dll, version 5.1.2600.2726, fault address 0x00120f57.
Is there any way in which i can trace this address to a exported function in the ole32.dll to get an ideea what exported function is crashing?
Thanks .
|
|
|
|
|
I have been trying to expose an ATL or class objects from an ActiveX control I have created using VC6 MFC.
Any Genius out there who have experience with this?
What I want is to have an ActiveX control "ControlX" what have a property "PropertyY" that is actually a class/ATL with methods and properties.
So If I am using VB6 to call a method in "PropertyY":
call ControlX.PropertyY.MethodZ
Any suggestions are welcome!
|
|
|
|
|
|
You can use #import to get wrapper classes for the stuff implemented, providing that the DLL has a typelibrary embedded in it.
Steve S
Developer for hire
|
|
|
|
|
Thanx Steve
Did u mean i should call getprocaddress on all functions i needed from that dll and make a wrapper around those functions...
Manish
|
|
|
|
|
You need to use #import "yourdll.dll" statement in your code. Doing so, .tlh , and .tli will be generated in debug/release folder. You can use .tlh as header.
|
|
|
|
|
Thanx prasad
I have used #import "mydll.dll" in my code but it giving error as
"fatal error C1083: Cannot open type library file: 'mydll.dll': Error loading type library/DLL"
Any alternative do you want to suggest,i think type library is not embeded in this dll...
Manish
|
|
|
|
|
You need to give, full path, mentioning "\\".
|
|
|
|
|
I ve tried all combinations with #import.
If i delete this dll then it shows no such file menas it currectly points to this dll.
Any sugestions or alternative??
Manish
|
|
|
|
|
Is type library for same dll is not there?
|
|
|
|
|
no!!
i was having only dll with me,how can i use that dll then??
Manish
|
|
|
|
|
Hello,
In my VC++.NET 2003 multithreaded application I need to use some COM server. I can call it from both threads using RCW, but after some period of time I have this error message: “COM object that has been separated from the underlying RCW can not be used” from the main thread. I don’t use Marshal::Release(…) explicitly, it means garbage collector decided to free some memory and destroyed my object. I already tried to increase reference count using Marshal::AddRef(…) and I tried to create additional global instance of this object. Both approaches didn’t work. How to tell Framework not to destroy this object? Please help!
Regards,
Leonid
|
|
|
|
|
Hi
I am using COM object in Web Application. There is a problem to solve authentication & authorization issue for Server site. At the time of using the COM object it shows the error " ACCESS DENIED ". If I am writing <identity impersonate="true"> in web.config, it is OK but the AJAX file is not accessible for that reason.
if I am using iisreset in Run command, then the whole application is OK, but it is not possible to reset iis again and again in production server. Have you any idea for this?
For more clarification, suppose there is a link in a Web page interface. After click the link, one Word document will open. How we solve authentication/authorization issue in iis without affecting to other files like AJAX.
I am using ASP.NET with C#. I am not using MTS.
any idea, please write.
regards
|
|
|
|
|
Hi
I am using static binding i.e the use of dll of MS OUTLOOK 2003 in my Windows application to extract FROM,TO,CC,BCC,MESSAGE email addresses and their names etc. and store it into an MS ACCESS database. The module is working fine in my machine and also in client machines, but some of the clients are complaining that they are getting the error at the time of running the module. They are also using MS Office Outlook 2003. They are getting the error when try to run the application.
The error is like this:
System.IO.FileNotFoundException: The specified module could not be found.
I think sometimes CLR fails to load unmanaged dll of OUTLOOK. I have tried by using most of things but till now there is no success. All the dlls are present in applications root folder.
Is there any idea?
regards
|
|
|
|