Hi,

i have a web application(made in C#.NET ) which opens excel spreadsheet in a frame by using

Response.Write("<script>window.open(' xls FilePath ');</script>"); . The excel file is opening correctly but my problem is once the document is open in the application it prevents
use of Excel outside the application.If the excel document was open before the one open by the application. i cannot edit the excel sheet outside the application.

Thanks,
Raymond.

Recommended Answers

All 11 Replies

Keep in mind that the opened excel file is a copy of excel file located at your webapplication. This copy is returned to you by the webserver.

This is a universal problem.

Hi,

My question is, is it not possible to have excel spreadsheet working in my web application and also another spreadsheet outside. We can open two excel spread sheet without any problem using Excel(not opening from web application). Why does an excel sheet inside my application affect the one outside? Both speadsheet are different.

Bye

Assume that I have an excel file and I am sending a copy of it to you. At your location you have changed this excel file. Is an excel file at my location will be updated? You know very well.

I think you have misunderstood my problem. Let me make it clear.
I have a web application which displays excel spreadsheet in a frame.

When i open an excel document say Excel1.xls outside my application(using excel as normally done) and then open an excel document name Excel2.xls(not the same excel sheet) in my application. The one inside the application is working fine but it seems to affect the one outside( Excel1.xls) . Now i cannot edit anything in that spreadsheet.I cannot even save it. Unless i close the one inside my application Excel2.xls . I have no control over the other excel sheet.

Why is this happening?? both are different excel sheets .

Thanks for your reply.

I think you have misunderstood my problem. Let me make it clear.
I have a web application which displays excel spreadsheet in a frame.

When i open an excel document say Excel1.xls outside my application(using excel as normally done) and then open an excel document name Excel2.xls(not the same excel sheet) in my application. The one inside the application is working fine but it seems to affect the one outside( Excel1.xls) . Now i cannot edit anything in that spreadsheet.I cannot even save it. Unless i close the one inside my application Excel2.xls . I have no control over the other excel sheet.

Why is this happening?? both are different excel sheets .

Thanks for your reply.

My motive was to understand your problem.

Now, what I got from your post #6 is

1. You have a web application and two excel files
namely excel1.xls and excel2.xls are inside the folder
of your application.

2. When you say "open" an excel document in the application - I guess you are opening an excel file with MSOFFICE api.

3. You say "open" an excel document outside the application - I guess you are opening an excel file with microsoft excel.

Yes you have got it now. I am using aspx page to display excel document in my web application by simply using response.redirect(..excel sheet path ) . The one outside i am saying is using MS Excel. Why does the excel sheet i open in my web page affect the one in MS Excel ?

You are not getting what I said in post #5. Response.Redirect() - Web browser request for "excel1.xls" to the web server and web server forword this request to an application server (say asp.net), now, asp.net again request a web server to send a copy of excel1.xsl to the web browser.

ok ok , i understand that.So i would have a problem with opening 2 excel1.xls files. but what about in my case when i opened excel1.xls and excel2.xls (they are completely different excel files). why should one affect the other? or is it not possible to have both open simultaneously(one by my web application so in browser and another one by MS EXCEL). I know you can do this with 2 excel files open in MS EXCEL.

Hi,

Here is a little demo, so that you can recreate the bug easily.


This is home.aspx
..

<frameset name="fr_main" id="fr_main" rows="*,50%"      frameborder="1">
		<frame name="fTop" id="fTop"    src="FrameTop.aspx" frameborder="1" >
		<frame name="fBottom" id="fBottom"   frameborder="1" >
	</frameset>

.................................


In FrameTop.aspx

..

<body>
    <form id="form1" runat="server">
        <asp:HyperLink ID="LinkButton1" runat="server">HyperLink1</asp:HyperLink>
                <asp:HyperLink ID="LinkButton2" runat="server">HyperLink2</asp:HyperLink>
                     
      
    </form>
</body>

.

In FrameTop.aspx.cs page

protected void Page_Load(object sender, EventArgs e)
    {
        
        LinkButton1.NavigateUrl = "FrameBottom.aspx?id=1" ; 
        LinkButton1.Target = "fBottom";
        LinkButton2.NavigateUrl = "FrameBottom.aspx?id=2";
        LinkButton2.Target = "fBottom";
       
    }

.......................................
In FrameBottom.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        string id=Request.QueryString["id"] ;
   


        if (id == "1")
        {
       
            Response.Redirect(@"http://localhost/TestSite/TempFiles/Excel 1.xls", true);

        
        }  
        else if (id == "2")
            Response.Redirect(@"http://localhost/TestSite/TempFiles/fiber.bmp", true);
       
        
    }

--------------------------------------


Before you run the application open another excel(not the same as the one in your web application) document by MS Excel application.


Thanks.

Also one more thing once you have open the excel document in the frame. Change the frame size. The bug strangely does not occur when frame is not resize!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.