Open word doc in browser

hi,
i am looking for solution to view docx files in browser. Is there any way we can view doc file directly in browser.

Actually i want to show doc file to view to user. i thought about two solutions.

  1. View doc file in browser.
  2. download doc file on client side and open automatically in MS-Word.

Is any of the above solution possible?. please let me know.

Thanks

Hi there,

Thanks for your inquiry. Aspose.Words for .NET is just a class library and with it you can programmatically generate, modify, convert, render and print documents without utilizing Microsoft Word®. So, it does not offer any UI or web control to view/perform document processing tasks.

If you just want to view pages of document, you can convert all pages in your Word document to images and then display them in browser. Here is how you can convert pages to images:

Document doc = new Document(MyDir + @"in.docx");
ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png);
opts.PageIndex = 0;
opts.PageCount = doc.PageCount;
opts.PageSavingCallback = new HandlePageSavingCallback();
doc.Save(MyDir + @"16.8.0.png", opts);
private class HandlePageSavingCallback : IPageSavingCallback
{
    public void PageSaving(PageSavingArgs args)
    {
        args.PageFileName = string.Format(MyDir + @"Page_{0}.png", args.PageIndex);
    }
}

You can send the output document to client browser to view the document in MS Word. Please refer to the following article:
Sending to a Client Browser