Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,
I want to open / Embed a excel file in a Window Form for preview. I have used WebBrowser control and using method
C#
webBrowser1.Navigate(filename,false);

This opens the excel file in a new excel window but i want it to be open within that webform control.
office version - Office 2013 x86
interop version - x86

Please help me out.

What I have tried:

tried changing the CPU from "AnyCPU" to "x86" also. But that didnt worked. Still excel opens as a new excel window. Tried both xls and xlsx formats.
Posted
Updated 23-Feb-16 20:32pm
Comments
Sergey Alexandrovich Kryukov 24-Feb-16 1:09am    
What makes you thinking that an Excel file (having nothing to do with W3 standards) can be opened in a browser or a browser control? :-)
—SA
amagitech 24-Feb-16 2:41am    
I think it try that http://www.codeproject.com/Articles/15760/How-to-Integrate-Excel-in-a-Windows-Form-Applicati
ashishnagvanshi 24-Feb-16 3:45am    
Yes Muharrem i am referring to same post. But it is not working out. Excel file is not opening in that windows forms frame. tried office object library 10,12,14,15 but no help.
ashishnagvanshi 24-Feb-16 3:42am    
Dear Sergey,
thanx for the rply, I am opening the Excel file in a Windows Form Project not in Web Project. And it is possible. Please check the below link..
http://www.codeproject.com/Articles/15760/How-to-Integrate-Excel-in-a-Windows-Form-Applicati
Sergey Alexandrovich Kryukov 24-Feb-16 8:24am    
What's the difference, a Web project or not? It's about server side and the whole concept of "project" is totally unrelated to the topic. You are talking about client behavior. And Excel has nothing to do with W3. What you open on a Form Project, what's possible and how is also unrelated. You are asking about Web Browser control; and this is the end of it.
—SA

1 solution

The browser control of .NET actually uses IE and it's settings...
The way a document to be opened decided by the end user (with some defaults), so you can not force a way to embed or not a document...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900