Sharad Birajdar

Hi,

I've written an office interface with VS2003. This interface works fine with all office version except office 2007. It throws folllowing the expection

at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

at Microsoft.Office.Interop.Excel.Shape.get_Hyperlink() at

Call to delete function throws this exception. (Following is the code)

Excel.Shape newShp = xlSheet.Shapes.Item(xlSheet.Shapes.Count);

address = address.Replace(cb.objectId,propBean.objectId);

newShp.Hyperlink.Delete();

this hyperlink property has value as "<error: an exeception of type: {System.Runtime.Intropservices.COMException} occured>"

Can anybody help me in this regard




Re: Visual Studio Tools for Office Exception with EXCEL 2007 API

Dennis Wallentin

Hi Sharad,

I've not bee able to reproduce the behavior in Excel 2007. I've tested with a managed Add-in created with VB.NET and also with an add-in created with VSTO 2005 SE.

Dim shape As Excel.Shape = xl_wsSheet.Shapes.Item(xl_wsSheet.Shapes.Count)

shape.Hyperlink.Delete()

I get exception(s) when the actually shape does not have a hyperlink (address).






Re: Visual Studio Tools for Office Exception with EXCEL 2007 API

Sharad Birajdar

Thnx for reply Dennis Wallentin ,

Yes. This problem is because shape does not have a hyperlink value. I tried to figure out exact problem. Here is what exactly happening.

In my excel sheet, I have first column which has image added and having hyperlink on that. User clicks on that to open that particular row. When i create Excel sheet, my office interface downloads all values from server side in *.mhtml file (single file web page) and opens it in excel. All columns and images getting exported/displayed in excel 2003 properly but same doesn't work with excel 2007. The images having hyperlink is not getting created in excel 2007 and that's the reason why i am getting that exception.

If you open this mhtml file in wordpad it has same text, still this file doesnt open properly in excel 2007. I have copied some part of that mhtml file. See if you can get any info where i am going wrong.

<tr ALIGN=3DCENTER VALIGN=3DTOP>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H0H0">Home</th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H1">Name</th>

=09=09=09=09<th WIDTH=3D32 BGCOLOR=3D#C0C0C0 ID=3D"H0H0"><v:shape style=3D'=

margin-left:2;margin-top:2;width:12pt;height:12pt'><v:imagedata src=3D"TcR-=

1.0.1746511703117053_files\Attachment.gif" o:title=3D""/><x:ClientData Obje=

ctType=3D"Pict"/> </v:shape></th>

=09=09=09=09<th WIDTH=3D32 BGCOLOR=3D#C0C0C0 ID=3D"H0H0"><v:shape style=3D'=

margin-left:2;margin-top:2;width:12pt;height:12pt'><v:imagedata src=3D"TcR-=

1.0.1746511703117053_files\Trace Link.gif" o:title=3D""/><x:ClientData Obje=

ctType=3D"Pict"/> </v:shape></th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H1">Number</th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H0">ROIN</th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H0">Type Name</th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H0">Create User</th>

=09=09=09=09<th BGCOLOR=3D#C0C0C0 ID=3D"H1H0">Create Time</th>

=09=09=09</tr>

------=_NextPart_01C7460D.387A5950

Content-Location: file:///C:/D4C81145/withImage_files/image007.png

Content-Transfer-Encoding: base64

Content-Type: image/png






Re: Visual Studio Tools for Office Exception with EXCEL 2007 API

Dennis Wallentin

Sharad,

I'm not good with HTML/XML so I hope some other here can help You out. Obviously there is some difference between 2003 and 2007.






Re: Visual Studio Tools for Office Exception with EXCEL 2007 API

Cindy Meister

Sharad

I recommend you pursue this question in the Excel programming newsgroup. You'll find many Excel specialists there who've been working with the new version since early Beta. They're most likely to know about the differences.

FWIW I have seen them discuss that the HTML Excel 2007 produces is radically different from that of previous versions. And this is "by design"...






Re: Visual Studio Tools for Office Exception with EXCEL 2007 API

Sharad Birajdar

Thnx guys. I will post this question at Excel programming news group