Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 11th, 2008, 05:59 PM
Registered User
 
Join Date: Nov 2007
Location: Chicago, IL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default export asp.net page to ms word and embed images

Hello All,

I am using this code snippet to export the contents of my asp.net page to an ms word doc giving the user the option to "Open", "Save", "Cancel".

            Response.ClearHeaders();
            Response.Clear(); //this clears the Response of any headers or previous output
            Response.Buffer = true; //make sure that the entire output is rendered simultaneously
                    Response.ContentType = "application/msword";
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + _ProjDocEntity.DocTitle + ".doc");

anyhow, when i do a local save of the created word doc, the pictures within the word doc(outputted html) are simply image references to the location of it on the web server. well, i need to create this word doc and instead of having the images as references, i need them to be embedded into the word doc the same as if i were to issue a "Insert Picture" from within ms word.

Do any of you know how to export an asp.net page into ms word and have the images embedded into the file so that the contents of the ms word doc are completely disconnected from any references to any external resources i.e. <img refs etc.?

thanks in advance.

  #2 (permalink)  
Old June 9th, 2011, 12:08 AM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default export asp.net page to ms word and embed images

Does any one find solution for reported issue so far? How can I embed image in word document from ASP.NET. Any clue?
Note: I'm working with VS2010.
  #3 (permalink)  
Old March 6th, 2014, 03:39 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: export asp.net page to ms word and

Hi, try using this .NET Word component for your conversion. I tested it out and it does create images from the URI referenced images.
Also it has a simple API for exporting Word file in ASP.NET with this Save method:
Code:
// Empty document.
var document = new DocumentModel();

// ...

// Stream the document to a browser.
document.Save(this.Response, "Document.docx");


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to export data to ms word from asp.net webapp parveen_kumar24@rediffmai .NET Framework 2.0 2 August 12th, 2006 05:17 AM
character count of ms-word in asp.net sh.rajkumar ASP.NET 1.0 and 1.1 Professional 0 May 19th, 2006 07:24 AM
embed images in email using system.net.mail Looney Classic ASP Basics 1 June 7th, 2005 05:11 PM
ASP.NET & MS Word Napoline .NET Web Services 1 May 11th, 2004 07:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.