We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word Dialog (Open or Save) does not open

I am using VS.NET 2005. I have referenced Aspose.Words and created the following sample in the code-behind:

protected void Button1\_Click(object sender, EventArgs e)
{
    Document doc = new Document(@"c:\Test\docTest.doc");
}

I step through the code and the instance is created but the dialog to open the file never pops up?

Hi

Thanks for your request. This code should not pop up any dialogs. This code creates the object of Document type. If you want to show the popup dialog you should do this in your code.

DialogResult result = MessageBox.Show("Open document?", "Open document", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
    Document doc = new Document(@"in.doc");
}
else
{
    return;
}

Best regards

Sorry,

I was not clear on what is not happening. Using my original code, the Word document does not open.

it just refreshes the page and Word does not open. It does nothing.

Hi

What do you mean? The Document class represents a Microsoft Word document that should be processed by Aspose.Words. Your code only creates the object of the Document class. After this you should process this document using Aspose.Words. See the following link.

https://docs.aspose.com/words/net/create-or-load-a-document/

If you want to save the document to a client browser then you should use the following code.

Document doc = new Document(@“c:\Test\docTest.doc”);

doc.Save("Report.doc", SaveFormat.Doc, SaveType.OpenInBrowser, Response);

Best regards.