PC Review


Reply
Thread Tools Rate Thread

C#, Word document

 
 
lsg
Guest
Posts: n/a
 
      25th Nov 2007
Hi,
Is there any possibility to write an application i C# to open a MS Word
document (doc, docx), find any form fields and fill them, save and print
modified (filled) document without Word installed? Or make that
application works with Word 2k, XP, 2003 version?
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      25th Nov 2007
Yes, but given that you want to span all of those versions, it will be
slightly difficult.

The reason is because microsoft only had primary interop assemblies for
versions of office back to XP. Because of this, you will have to create an
interop assembly to make the calls to Word 2k yourself.

Or, you could make all the calls late bound, through reflection,
although you might take a performance hit by doing so. However, it would
simplify making the same calls across different versions (assuming the
parameter signatures of the methods you are calling are the same).

--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"lsg" <(E-Mail Removed)> wrote in message
news:fiblvf$kor$(E-Mail Removed)...
> Hi,
> Is there any possibility to write an application i C# to open a MS Word
> document (doc, docx), find any form fields and fill them, save and print
> modified (filled) document without Word installed? Or make that
> application works with Word 2k, XP, 2003 version?


 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      26th Nov 2007
"lsg" <(E-Mail Removed)> wrote in message
news:fiblvf$kor$(E-Mail Removed)...

> Or make that application works with Word 2k, XP, 2003 version?


Aspose can do this:
http://www.aspose.com/Products/Aspos...s/Default.aspx


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Wallace Stephen
Guest
Posts: n/a
 
      29th Mar 2011
Create New Word Document

object oMissing = System.Reflection.Missing.Value;
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);


Open Word Document

object oMissing = System.Reflection.Missing.Value;
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
object fileName = @?E:\CCCXCXX\TestDoc.doc?;
oDoc = oWord.Documents.Open(ref fileName,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

More operations about C# Word can be found here;
http://stephenchy520.blog.com/2011/0...ms-word-via-c/

> On Sunday, November 25, 2007 6:23 AM lsg wrote:


> Hi,
> Is there any possibility to write an application i C# to open a MS Word
> document (doc, docx), find any form fields and fill them, save and print
> modified (filled) document without Word installed? Or make that
> application works with Word 2k, XP, 2003 version?



>> On Sunday, November 25, 2007 9:18 AM Nicholas Paldino [.NET/C# MVP] wrote:


>> Yes, but given that you want to span all of those versions, it will be
>> slightly difficult.
>>
>> The reason is because microsoft only had primary interop assemblies for
>> versions of office back to XP. Because of this, you will have to create an
>> interop assembly to make the calls to Word 2k yourself.
>>
>> Or, you could make all the calls late bound, through reflection,
>> although you might take a performance hit by doing so. However, it would
>> simplify making the same calls across different versions (assuming the
>> parameter signatures of the methods you are calling are the same).
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - (E-Mail Removed)
>>
>> "lsg" <(E-Mail Removed)> wrote in message
>> news:fiblvf$kor$(E-Mail Removed)...



>>> On Sunday, November 25, 2007 7:43 PM Mark Rae [MVP] wrote:


>>> Aspose can do this:
>>> http://www.aspose.com/Products/Aspos...s/Default.aspx
>>>
>>>
>>> --
>>> Mark Rae
>>> ASP.NET MVP
>>> http://www.markrae.net




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
accidentally moved a MS Word document,now it dissapears everytime i open any word document tim Windows Vista Performance 1 28th Sep 2007 11:40 AM
accidentally moved a MS Word document,now it dissapears everytime i open any word document tim Microsoft Word New Users 1 28th Sep 2007 11:20 AM
accidentally moved a MS Word document,now it dissapears everytime i open any word document tim Windows Vista General Discussion 2 14th Sep 2007 06:44 PM
Document edited with MS word-2003; MS-word crashes if that document is opened with older MS word versions qazmlp Microsoft Word Document Management 2 27th Apr 2005 07:11 AM
Exporting/Extracting an Access OLE object (Word document) to a Word document file Otis Hunter Microsoft Access Queries 0 9th Jul 2004 04:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 PM.