Word Document Viewer RRS feed

  • Question

  • Hi to all Experts,

    Aiming to create word document viewer, how can i get in to this, i look into the Toolbox>Choose Items? but there is no word document items, how can i add the control from toolbox, thanks

    or open word documents in read-only, thanks
    • Edited by VBcodeHyper Tuesday, February 24, 2015 3:43 AM
    Tuesday, February 24, 2015 3:18 AM

All replies

  • Hello,

    There are no standard controls to view MS-Word documents. I have seen code in the past that uses API calls to embed a document into a Windows form but do not have the code myself, perhaps someone else may.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Tuesday, February 24, 2015 12:11 PM
  • You may try using GroupDocs.Viewer for .NET that support rendering of Word document as HTML pages or Images. The API renders each page in the source document as a separate HTML page or image. Once you have got the rendered pages, you can view them in your front end application and the end user won't be able to edit the source Word document. This is how it works:

    ViewerConfig config = new ViewerConfig();  
    config.StoragePath = "D:\\storage\\";  
    // Create HTML handler (or ViewerImageHandler for rendering document as image)  
    ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);  
    // Guid implies that unique document name   
    string guid = "sample.docx";  
    // Get document pages in html form  
    List<PageHtml> pages = htmlHandler.GetPages(guid);  
    foreach (PageHtml page in pages)  
        // Get HTML content of each page using page.HtmlContent  
    // Or Get document pages in image form using imagehandler  
    /*List<PageImage> pages = imageHandler.GetPages(guid); 
    foreach (PageImage page in pages) 
        // Save each page as image 

    Saturday, June 15, 2019 4:47 PM