.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Export to Word and include an image

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Hi, I am able to export a gridview and other tables into Word, but i want to include an image in this.  How is this possible.  If i do as below the image is not displayed. Please see my code below:         Response.Buffer = True        Response.ContentType = "Application/vnd.ms-word"        Response.ContentEncoding = System.Text.Encoding.Default        Response.AddHeader("content-disposition", "attachment;filename=participant_attendance.doc")        EnableViewState = False        Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter        Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)         Dim style As String = "<style> .textmode { mso-number-format:\@; } </style>"        Dim table_text As String = String.Empty        Dim contact_text As String = String.Empty         ' Top table which contains the course information.    &nb

View Complete Post

More Related Resource Links

Configuring Profile Image Export in SharePoint 2010

It's no secret that I am thrilled with the new social features of SharePoint 2010. I am most excited about the new Profile Picture handling. I strongly believe that the more we can show the faces of our colleagues to one another the more connected we will feel. Clearly Microsoft feels that way as witnessed by the many features that make use of the Profile Image like the Activity Feed and Colleagues list

How to insert Image (jpeg) into MS Word Programmatically using VB.NET


Hi there,

Can someone help me on How to insert Image (jpeg) into MS Word Programmatically using VB.NET..not C#.NET??? Sad

I could hardly find any articles for the coding. Preferably using Bookmark...can i have the sample code.



Export Multiple Gridviews To Word

Hi, I am trying to export multiple gridviews to Word.  I am able to do this but what i want to do is add some headings and text in between each grivdiew.  Please see my code below i am using to export the gridviews.         Response.Buffer = True        Response.ContentType = "Application/vnd.ms-word"        Response.ContentEncoding = System.Text.Encoding.Default        Response.AddHeader("content-disposition", "attachment;filename=evaluation_report.doc")        EnableViewState = False        Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter        Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)         dv_course_information.RenderControl(oHtmlTextWriter)        gv_gp_practices.RenderControl(oHtmlTextWriter)        gv_attendance_summary.RenderControl(oHtmlTextWriter)        gv_useful_activities.RenderControl(oHtmlTextWriter)         Response.Write(oSt

Trying to include version history table inside Word document

Running MOSS 2007 with SP1, Office 2007.   I'm trying to create a table (doesn't have to be a table though) of a document's version history inside the document. This would be the history information kept by SharePoint. Since we can't even easily get just the current version number into the document I'm having problems and thought I'd see if anybody has a bright idea.   First, a couple facts. From Word 2007 it is possible to view the Document Library version information by clicking on the Office Button > Server > View Version History. This brings up the following: Click for screenshot   My goal is to get that version information displayed IN the document so when it is printed there is a document history. I tried using IRM label policies, but this only displays the current version and you can't include the comments.   After some digging I found the following code sample on MSDN:   Code SnippetDim dlvVersions As Office.DocumentLibraryVersions    Dim dlvVersion As Office.DocumentLibraryVersion    Dim strVersionInfo As String    Set dlvVersions = ActiveDocument.DocumentLibraryVersions    If dlvVersions.IsVersioningEnabled Then        strVersionInfo = "This document has " & dlvVersions.Count & " versions: " & vbCrLf        For Each dlvVersion In dlvVersions            strVersionInfo = strVersionInfo & _                " - Versi

Include certificate chain in pfx export

When using the export method of an X509Certificate2 object, can anyone tell me how to include the certificate chain within the pfx file? I would like to accomplish this without using CAPICOM. I can successfuly export the certificate but the trust chain is not included in the pfx file.

ssrs 2008 export to word 2010



I am having an issue with the header on an rdl file (ssrs 2008) when I export to word 2010.  The header gets cut off at the top of the page (about .5 inch).  But when I export to a PDF file it is fine.  If all our users exported only to pdf this would not be an issue, but unfortunately our users use both word and pdf to print out the reports.



SSRS Word Export Issue- Last Column Data getting Trim


We are exporting a SSRS report in Word. The last colum is getting displayed without its right side vertical bar. Data is also getting trim. Please let us know the solution on this.


Issue with Excel and Word Export - SSRS 2008


Hi there,

          I have created fairy simple report having a table in body section and Header, Footer. I have set the Report Properties

Orientation - Landscape

Paper Size - Custom

Width - 11in & Height - 8 in

Margins - Left 0.25 in , Right 0.25 in, Top 0.5 in, Botton 0.5 in

Issue NO 1: When i export the report to Excel, it takes margin as Left 0.75 in , Right 0.75 in, Top 1 in, Botton 1 in, because of this some part of my Report is cut. what should i do to keep margins of Excel as per margins set in RDL.

Issue No 2: In Footer excel shows Page 1 of 1 for all the pages

Expression used :



"Page" & Globals!PageNumber & " of " & Globals!TotalPages;

Issue No 3: when i export the Report to word, it does not consider landscape and show only middle part of report, cut rest of the report data.

Word Export error when orientation is Landscape in SSRS 2008


Hi there,

        I have created a report in SSRS 2008, In the report properties I have selected Orientation as Landscape but when i Export the report to Word it prints the report on middle of the page and cuts the rest of the report.

Urgent help is needed!!!

ASP.met Export image to Excel


Hi there,

How could we Export an image to Excel on top of a gridview, using Respone.Write

Thanks in advance

SSRS 08 SP2 - Export to Word places the Footer 0.5" from the bottom


I am using SSRS 08 SP2.  I have a report that has top and bottom margins of 0.25".  This report also has a page header and footer.  When I export the report to Word, the page margin settings from the report export correctly to Word, BUT the footer is displayed 0.5" from the bottom and the header is displayed 0.5" from the top, so the document appears to have a .75" margin.  This can be edited in the Word document by clicking "Edit Footer" and then going to the design tab and changing the "Header from Top" and "Footer from Bottom" settings manually.  However, is there any way to change the report so it exports to Word with the correct margins automatically?  My users don't want to edit the report manually each time it is generated.

Also, this is not an issue when exported to PDF.  The margins are also not an issue if the page footer and header are removed and the report is exported to Word.  It only occurs with a report with page headers/footers that is exported to Word.  However, in my current project, it is not an option to use PDF and I cannot remove the page header/footer.

report viewer: Adding Image to local report export drop down list


Is there an easy way to add image to the drop down list that is build into the report viewer export list?



Reportviewer 2010 redistributable export to Ms Word pagenumber problem


Hi, in my asp.net app I use the Reportviewer 2010 tot show reports (RDLC). This is working fine, but when I export to Word the pagenumbers is always 1 from 1 even when the document contains 2 or more page, while when I export to PDF it is showing the right page number.

Anyone has the same problem?

Can you have InfoPath export a list into a Word Doc and have that mailed?


Have a very particular question here. We have a client that have items located in a list within SharePoint 2007. Their requirement is as follows...

After a new item is created

Take the items in the list and generate a new word document

Attach that word document with any other attachments to the item and email that to the client.

I was told this can be done in InfoPath but I don't see where InfoPath could automatically generate a Word Document from a list and email it somewhere. If this is possible can someone point me to an example please?

Any help is appreciated, thank you in advance.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend