Free Support Forum - aspose.com

IE does not open Aspose file in its window

Good day,

I’m working wtih evaluation version (2.0.5.0) of Aspose.Word. I create a new document using MailMerge feature, store it on the disk and send to the user. The problem is: when I do the same using Word automation object, Internet Explorer opens the document in its self window. But when I send an Aspose document, Internet Explorer runs a separate instance of Word and opens the document in it.

I tryed different methods, but even document.location.href = DocumentPath shows the document in a separate Word window!

My friend has registered version of Aspose (1.8.1.0) and I can open his files without any problems - I mean, inside IE.

Could you tell me how I can fix the problem?

Thanks in advanse,
Serge

BTW, your own examlpe (from Demos page) does the same. If it is the new version’s feature, is it possible to buy a previous version?

Serge

Hi Serge,

Aspose.Word demos as I can see now opens Word documents in the same IE window. Is this the behaviour you want?

If you use Document.Save(string fileName, SaveFormat fileFormat, SaveType saveType, HttpResponse response), then SaveType can be OpenInWord or OpenInBrowser which control the way the document is opened.

All it does behind the scenes is justs sets an HTTP header appropriately:
if(saveType == SaveType.OpenInWord)
response.AddHeader(“content-disposition”,“attachment; filename=” + fileName);
else
response.AddHeader(“content-disposition”,“inline; filename=” + fileName);

But you say that you save the file to the disk first? In this case how do you send it to the browser then?

romank wrote:
Aspose.Word demos as I can see now opens Word documents in the same IE window. Is this the behaviour you want?


Yes, exactly. And looks like everyone but me sees the correct behaviour. Maybe I have a bad Word?

romank wrote:

If you use Document.Save(string fileName, SaveFormat fileFormat, SaveType saveType, HttpResponse response), then SaveType can be OpenInWord or OpenInBrowser which control the way the document is opened.


I tryed this way. But even I use OpenInBrowser save type, IE still opens the document in Word (without asking user about opening/saving it).

romank wrote:

But you say that you save the file to the disk first? In this case how do you send it to the browser then?


I use Response.Redirect. The same method works correct when I make redirecting to a native Word document.

My guesses: IE sees the document and tryes to open it. I don't know details, but I think IE looks for associated with extension application. It is Word. But IE cannot create Word's OLE object because of some problems, instead it saves the file to temporary directory and runs Word (or calls ShellExecute and Windows runs Word).

I thought along the same lines. Either this or some security configuration of MS Word or IE that prevents it launching MS Word as an ActiveX control.

You can try either reinstalling MS Word or playing (carefully) with security settings.

I would suggest looking up in MS Knowledge Base too.