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

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

C#NET2008 Using Microsoft WORD Template

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :Windows Application

Hullo Good Guys,

I encountered an interest error trying to transfer data from DR (DataReader) onto WORD 2003 Template created with Textbox and Table. The folder path and Template document name was retrieved by using OPENFILEDIALOG.



Error message:

Error 1     The best overloaded method match for 'Word.Documents.Add(ref object, ref object, ref object, ref object)' has some invalid arguments


This coding generate the error message above

View Complete Post

More Related Resource Links

How to use Microsoft.office interop.word in website

Hi, I have a page which creates a word doc from templet string location = Server.MapPath("~/temp/" + filename); Application app = new Application(); Document doc = app.Documents.Add(location); if(doc != null) { //Some code here } it works fine when i run from visual studio, but when i deploy it as a website in local IIS, its not working.I gave the permissions needed to access the folders in the website. What should i do to make it work. Thanks

saving docx as pdf with Microsoft.Office.Interop.Word in sharepoint

Hi!Im trying to export my docx file to PDF with Microsoft.Office.Interop.Word but im stuck. Anyone with some great ideas that could save my day.The code that im running is working fine localy but i can´t get it to work in sharepoint.The most commin exception is file not found (the same path is working fine localy)...Pls give me a hint!

Microsoft Word hyperlinks not working consistently in Sharepoint

I'm running into an issue with some Word hyperlinks.  I have a Word document (with embedded hyperlinks) uploaded to a document library.  If I go into the library and click on the document, the hyperlinks work as intended (which is to say that the embedded hyperlinks open up a .pdf in a NEW window). However, on my home page, I have a link to the Word document directly (not to the library, to the actual file).  If I use this link, then the embedded hyperlinks open the .pdf in the SAME window. Part of the issue seems to be that when I open the document from within the library, it opens it with what I'll call a Word emulator whereas if I follow the link from the home page, it opens it with a regular web browser.  Is there a way to get the link from the home page to also use this emulator?  Alternatively, are there any other solutions?  I really need to be able to use the home page link method.

Opening New Word Document with Template Selection in C#

From a Windows Forms Application, I need to launch Word. There is an option to create a new document template in the Application. So to implement this, I need to launch the template selection window (You get it when you click File->New in 2007). Once the user selects the template, a new document is created with the selected template. How do I achieve this using Word Object Model?

ItemAdded fails after Microsoft.Office.Word.Server.Conversions.ConversionJob was completed

Hey, I defined a ConversionJob from doc to pdf inside and the doc-file is located in a  document library and the job goes through without any problems. The pdf is created as expected. However if I try to catch an ItemAdded event the debugger starts every time the ConversionJob is finished and if I agree to debug the problem the debugger proceeds after the first time I hit F10 no matter how much code is located in the eventreceiver. The "error" seems to occur in the first line of my event receiver no matter what's in that line. If I got something like "string test = "text";" the debugger will come up anyway. I'm really confused by this behaviour and I hope somebody has worked with ConversionJobs from Word Automation Services before.

insert DATA sql in word template

hi everybody i'm looking for tutorial  to help me for a projecti have word template . i want to insert data from sql server data  base into this template .using asp.neti didn't found a good exemple in the internet to resolve my problemethanks for helpregards

How to open and read Word content using Open XML SDK 2.0 for Microsoft Office?

Hello, I've built a component to read a Word Document and open it in silverlight, so I'm interested in Open XML SDK 2.0 for Microsoft Office, I read the document about this and some several examples, they're just talk about read the Headers, Comment,...and also I want to read the Word content.   Please help me, thank you.

InfoPath / ActiveX error when using person selector field in Word template off SharePoint document l

I have created an out-of-the-box document library on a SharePoint 2010 site.  I left Microsoft Word Document selected as the Document Template.  I then added a person or group column and a multiple lines of text column to the document library. I then went into Library Settings --> Advanced Settings and clicked on Edit Template, opening the template in Word.  I created my template and added the two new columns to the document.  I did this using the Quick Parts --> Document Property --> [column name] feature under the Insert tab in Word.  I then saved the template back to SharePoint. Upon opening the template or creating a new document from the template, I get the following dialog box: --------------------------- Microsoft Office InfoPath --------------------------- One or more ActiveX controls could not be displayed because either: 1) Your current security settings prohibit running ActiveX controls on this page, or 2) You have blocked a publisher of one of the controls. As a result, the page might not display correctly. --------------------------- OK   --------------------------- I've searched around (I believe fairly extensively) and have not run into anyone else with the same issue.  Some have mentioned a similar error when creating a custom document information panel in InfoPath, and suggested lowered ActiveX security setti

Extract Word document & Convert those extracted pages to images using Microsoft.Office.Interop.Word

You cannot vote on your own post 
Hi Everyone.

I need to extract word document into number of pages and convert those pages into images by using Microsoft.Office.Interop.Word, can anybody tell me how i can do this?

Microsoft Word Mail Merge Problem


I wrote code to create label from Microsoft Word Mail Merge using Visual Studio 2008 ASP.NET C#. This is my code:

public void CreateLabel(string strCSVPath, string strTemplatePath)
            Object fileName = strTemplatePath;

            Object missing = System.Reflection.Missing.Value;
            Object oEmpty = "";
            Object oFalse = false;
            Object oTrue = true;
            Object oAutoFormat = word.WdOpenFormat.wdOpenFormatAuto;

            word.Application wApp = new word.Application();
            word.Document wDoc = wApp.Documents.Open(ref fileName,
                ref missing, ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing, ref missing, ref missing);
            word.MailMerge wMM = wDoc.MailMerge;

            wMM.OpenDataSource(strCSVPath, ref oAutoFormat, ref oTrue, ref oFalse, ref oTrue,
                                ref oFalse, ref oEmpty, ref oEmpty, ref oFalse, ref oEmpty, ref oEmpty,
                                ref oEmpty, ref oEmpty, ref oEmpty, ref missing, ref missing);

            wMM.DataSource.QueryString = "SELECT * FROM " + strCSVPath;

            wMM.Destination = word.WdMailMergeDestination.wdSendToNewDocument;


Solution requirement word template SP2010


I am trying to create solution requirements for SP2010?, can someone he;p me to provide me a barebones to start with

thank you

activeX error when starting a workflow from inside Microsoft Word


I have a Word 2007 document hosted on a local intranet SharePoint 2007 Server.
When i open the document inside Word 2007 and start a Collect Signature workflow (the word document has some signature lines included), the following ActiveX error si thrown:

Microsoft Office InfoPath
One or more ActiveX controls could not be displayed because either:

1) Your current security settings prohibit running ActiveX controls on this page, or
2) You have blocked a publisher of one of the controls.

As a result, the page might not display correctly.

I managed to find out that the error is generated because of the security level regarding ActiveX controls set on the INTERNET zone.
In the internet zone, all ActiveX controls are restricted to run, but in the LOCAL INTRANET zone are allowed.
Our company security policy does not permit changing the ActiveX settings in INTERNET zone.

If i navigate to the sharepoint site in Internet Explorer, the site is seen correctly in the LOCAL INTRANET zone

Can somebody give me a solution to be able to start the workflow process, without modifing security settings on the internet zone and without upgrading to O

open the microsoft word through ASP.NET



I open Microsoft Word through ASP.NET , when I load by visual studio 2008 works well.

but when I put my site in my IIS folder and access the site through Internet Explorer and click the button nothing happens.

Don't happen anything. Why my code : 

 wdApp = New Microsoft.Office.Interop.Word.Application

doens`t works?

Sharepoint 2010 List data to Word Template via Workflow


Ok, I am using Sharepoint 2010 and Designer as well as Infopath 2010. I have a requirement to send out a word document (via workflow) that will be a template that references fields from my Sharepoint List.

Any help is appreciated, I do not want to buy anything extra and a no-code solution would be best.


Does Microsoft.Office.Interop.Word Requires MS OFFICE Installation???


Hi Team,

I'm developing an application in WPF which generates a WINWORD for that I'm Using

Microsoft.Office.Interop.Word dll but is it Manditory to have MS OFFICE installed to work dll ???

Please, Answer my query

Thanks in Advance

External Data Fields in a Word Template saved as a content type in a document library with multiple


I have created a Word Template for a Document Library that has an External Data Column in it of Client Name which also adds Client Address1, Client Address2, Client City, Client State, & Client Zip.  Now this works fine for a Document library with that template as the Template.dotx file. 

I want to be able to make a bunch of Templates and have them all as Content Types in one Library.  When I do this I cannot get the External Data Quick Parts to work.

Anyone have any ideas?

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