473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C#NET2008 Fill Microsoft WORD 2003 Document template with Data

126 100+
Hullo Good Friends,
I need your help. Please help me.

I am using C#NET2008 to develop Window Application to fill Microsoft WORD 2003 Template textbox with data from FORM textbox control input my user then print save and print the WORD Template as Letter to the customer.

Apparently it is now working as I have not done it before
This is the error message
Error 1 The best overloaded method match for 'Word.FormFields.this[ref object]' has some invalid arguments

This are the codings that generated it:
oDoc.FormFields["dtxtDatePrint"].Range.Text = DateTime.Now.ToShortDateString;
oDoc.FormFields["dtxtCompName"]).Range.Text = strCustArray[0];


Expand|Select|Wrap|Line Numbers
  1.  if (DR.HasRows== true )
  2.      {
  3.  
  4.       object objFileName = strFileNamePath;  // F:\\SaleDepart\\Custfolder\OrderLetter.dot
  5.       object objReadOnly = false;
  6.       object objIsVisible = true;
  7.  
  8.       object oMissing = System.Reflection.Missing.Value;
  9.       Word.Application oWord = new Word.Application();
  10.       Word.Document oDoc = new Word.Document();
  11.       Word.Table oTable;
  12.  
  13.       oWord.Visible = true;
  14.  
  15.       oDoc = oWord.Documents.Add(ref objFileName, ref oMissing, ref oMissing, ref oMissing);
  16.  
  17.     // template control : dtxtDatePrint, dtxtCompName 
  18.  
  19.          oDoc.Activate();
  20.      Doc.FormFields["dtxtDatePrint"].Range.Text =        DateTime.Now.ToShortDateString;
  21.      oDoc.FormFields["dtxtCompName"]).Range.Text = strCustArray[0];                   
  22.  
  23.         } 
Oct 28 '10 #1
0 1656

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: FinallyInSeattle | last post by:
I have an old product that generates a Word document using Word Automation (tables, pictures, etc). The execution speed is quite slow and I'm finally at the point where I can tell my customers...
0
by: Marco Moioli | last post by:
Hi everybody: I wanto create a simple Add-in button for Word that show me a string that represent the path of the current opened document. I know how create an Add-in button, but I don't know...
1
by: kstriyhon | last post by:
i need to create a new word 2003 document within a c# web application. this is the code i´m using private Microsoft.Office.Interop.Word.ApplicationClass WordApp = new...
1
by: =?Utf-8?B?UmF2aQ==?= | last post by:
public WordApp() { //oWordAppl = new Microsoft.Office.Interop.Word.ApplicationClass(); } When I click a button in my aspx file I geet the followign error. I am trying to open word from...
0
by: =?Utf-8?B?U2VhRmlyZQ==?= | last post by:
I am able to search through custom properties of a Microsoft Word 2003 file. I have yet to figure out the call to update a custom property. I receive a System.Reflection.TargetInvocationException...
2
by: djamila | last post by:
Hi, I work in a c# project that uses Microsoft Word to generate report. In my program I use Interop.Word reference. When I run the program in my PC with Microsoft Word 2003, all work well....
2
by: davidson1 | last post by:
Hello Friends, I have installed new Windows XP.I want Microsoft word 2003...Where Can I download????.I search in Google.But I could not find a Proper website..Can you Help me....Thanks in...
2
by: lenniekuah | last post by:
Hullo Good Friends, I need your help. Please help me. I am using C#NET2008 to develop Window application I am trying to retrieve Sales Transaction and print it on WORD Document as statement...
0
by: lenniekuah | last post by:
Hullo Friends, I need your help. Pleas share with me sample coding. Doing C# Window application to output data onto Microsoft WORD Document without using Template. These are how it appear on...
1
by: Lennie Kuah | last post by:
Hi Good Guys, I need your help. Please help me. I am using C#NET2008 and Window Application to print Customer Order Transactio onto Microsoft WORD 2003 document. This is the expect result on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.