Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.Office.Interop.Word;
public partial class Articles : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        Microsoft.Office.Interop.Word.Application objWordApp = new Microsoft.Office.Interop.Word.Application();

        //ACCESSING THE WORD FILE PATH

        object objWordFile = Server.MapPath("Images\\water crisis.doc");

        object objNull = System.Reflection.Missing.Value;

        Document WordDoc = objWordApp.Documents.Open(

        ref objWordFile, ref objNull, ref objNull,

        ref objNull, ref objNull, ref objNull,

        ref objNull, ref objNull, ref objNull,

        ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull);

        WordDoc.ActiveWindow.Selection.WholeStory();

        WordDoc.ActiveWindow.Selection.Copy();

        string strWordText = WordDoc.Content.Text;

        WordDoc.Close(ref objNull, ref objNull, ref objNull);

        objWordApp.Quit(ref objNull, ref objNull, ref objNull);

        // Asssigning word file value to bind the div

        divfordisplaywordcontent.InnerHtml = strWordText;

    }
}
Posted
Comments
Master Vinu 30-Mar-13 5:33am    
it shows very narrow snap and not showing images also

1 solution

use object objWordFile = Server.MapPath(@"~\Images\\water crisis.doc");
instead of object objWordFile = Server.MapPath("Images\\water crisis.doc");
 
Share this answer
 
Comments
Master Vinu 30-Mar-13 7:17am    
not working it shows very narrow snap and not showing images also

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900