ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error while creating excel sheet in office 2007 using mhtml (https://www.excelbanter.com/excel-programming/382447-error-while-creating-excel-sheet-office-2007-using-mhtml.html)

Sharad Birajdar[_2_]

Error while creating excel sheet in office 2007 using mhtml
 
Hello friends,

I am facing problem while creating excel sheet in office 2007 using mhtml.

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(Strin g 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"

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




--------------------------------------------------------------------------------
sharad



All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com