Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Excel webbrowser
Hai,
 
I am trying to display the Excel document in windows forms using the webbrowser Control.

using the code googled in Codeproject How to Integrate Excel in a Windows Form Application using the WebBrowser[^] and i am able to disaply excel(.xls and .xlsx) files in 32 bit Operating System correctly in webbrowser control.
 
But when i trying to execute the code in 64-bit operating system .xlsx type Excel files didn't open in webbrowser Control instead they were opening as normal excel file but .xls files opening correctly in webbrowser Control.
For that i executed the register Script to change the registry settings using the below link http://support.microsoft.com/kb/927009[^]
but .xlsx files always Open separately as like Office excel file instead of opening it in webbrowser Controls.
 
Presently i am using Microsoft Office 2010 software as my office tool.
 
Please provide the solution to open the .xlsx files to be open in webbrowser control.
 
Thank you.
Posted 19-Jan-13 0:18am
Comments
valery possoz at 19-Jan-13 6:01am
   
Set you project as x86, not AnyCPu. That will force it to execute as a 32bit process even on 64b platforms.
adriancs at 19-Jan-13 6:18am
   
+1 Vote Up
V G S Naidu A at 20-Jan-13 23:27pm
   
thank you possoz, it's working with your technique. but i need to run the project as any cpu because it has the 64-bit dll's which support 64-bit operating system. if u please give me another suggestion.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you have 32 bit office installed in a 64 bit OS, you must compile your winforms application as "x86" not "AnyCPU". If it is compiled as "AnyCPU" it will start the 64 bit CLR which cannot host 32 bit office interop dlls.
 
The older xls format was supported by the Jet engine, which has side by side support for both 64 and 32 bit, the newer xlsx format is supported by a newer engine that does have side by side support. This is a major pain in the neck, but the information about 64 bit support was directly from Microsoft support - they nmo longer intend to provide side by side support, as the see the file support as part of office, not part of the OS. Fortunately, few people install 64 bit office, even on a 64 bit OS, so compiling for x86 will work with 32 bit office on either OS. If you have to support both 32 bit office, and 64 bit office, you will need two versions (one AnyCPU or x64 and one x86), and will need to determine which office version you are interacting with at install time.
  Permalink  
v2
Comments
V G S Naidu A at 20-Jan-13 23:26pm
   
Hai Rob, thank you for your useful information.we have installed 64-bit office version in vista 64 bit Os,my application is running the project with the property "Any Cpu".In this case i could not open the office Excel(.xlsx) file embeded in winforms control(webbrowser control).it's working fine if i build the project as x86 type,but i could not make my Project as x86 type version because the project also running on 64-bit dll's, so i put it as any cpu. Here actually if i made my project as "Any CPU or x64" the .xlsx file opens as normal Excel file it's not loaded in webbroser control eventhough the 64-bit office installed.will please provide the another solution. Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 265
1 Sergey Alexandrovich Kryukov 202
2 George Jonsson 185
3 King Fisher 185
4 CPallini 155
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100