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

Free Support Forum - aspose.com

Displaying Word Document in a WebPage

Hi Team,

How can i display a Word Document in a Webpage using Aspose Component
is that possible to do so,

please let me know,

Shiva.

Hi Shiva,

Thanks for your interest in Aspose.Words. Using Aspose.Words, you can generate document preview. For example, you can use XPS to achieve this. You can find an example here:

Or you can convert your document to an image and show this image.

Hope this helps.

Best regards,

Hi Shiva,

Regarding the conversation we had on Live Support, I have made a simple example for you which displays a rendered document in a web browser using ASP.NET and Aspose.Words.

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<b>Document Preview</b>
<div>
<img src="Preview.jpg" alt="A rendered document using Aspose.Words"/>
</div>
</form>
</body>
</html>

Default.aspx.cs

using System;
using Aspose.Words;
using Aspose.Words.Saving;
namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string filepath = @"filepath" + "Test Document.doc";
            Document doc = new Document(filepath);
            doc.SaveToImage(0, 1, Server.MapPath("Preview.jpg"), new ImageOptions());
        }
    }
}

Please feel free to ask if you have any further questions.

Thanks,