I was trying to read the html elements using Microsoft.mshtml.dll and this is working fine when the project platform target is x86. Its able to extract the html elements, but when I tried to change the platform target as x64 its getting me exception as shown below
Message: Unable to cast COM object of type 'System.__ComObject' to class type 'mshtml.HTMLTableClass'. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type. Instances of this type cannot be cast to any other class; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Source: VoyagerDocuments
StackTrace: at
DataCollection.Forms.Viewers.VoyagerHtmlDocumentViewer.buildMappingsTable(IHTMLElement tab, IHTMLElement ourCell, String tableName, String src, HtmlDocument CTAUTO_htmlDocument, String auto_scaling, String table_text) in C:\Dilip\DataCollection\VoyagerDocuments\Forms\Viewers\VoyagerHtmlDocumentViewer.cs:line 1371
at DataCollection.Forms.Viewers.VoyagerHtmlDocumentViewer.ReadSpecificTable(String tablename) in C:\Dilip\DataCollection\VoyagerDocuments\Forms\Viewers\VoyagerHtmlDocumentViewer.cs:line 1207
at DataCollection.Forms.Viewers.VoyagerDocumentViewer.toolStripMenuItemBSDifferentiated_Click(Object sender, EventArgs e) in C:\Dilip\DataCollection\VoyagerDocuments\Forms\Viewers\VoyagerDocumentViewer.cs:line 6020
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at TRF.Collection.App.Main()
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
In the current project we have 64 bit dll to read pdf file. Need help on how can I cast this html elements in x64 target platform using 32 bit Microsoft.mshtml.dll
Can you let us know is there any 64 bit microsoft.mshtml.dll.
Code we are trying to cast is as below
HtmlTableElementInfo _tableSelectedElement;
var tableEntry = (IHTMLElement) _tableSelectedElement.tableElement;
IHTMLElement el = tableEntry;
IHTMLElement tab=el;
IHTMLElementCollection Rows = ((HTMLTableClass) tab).rows;
temp_tablearray = new IHTMLElement[Rows.length,100];
Thanks,
Dilip