473,405 Members | 2,300 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,405 software developers and data experts.

Word Automation with C#

I've got a question about C# together with MS Word 2003.
I've got a C# applikation and I want to write any data into
Word. But how I can position this text without linebreaks.
I think it should work with a Textbox. And now the
question, how I can create a textbox in my C# - code and
position it in Word. (Without MSForms).
Nov 16 '05 #1
4 9189
Roger,

You won't be able to do this. Word doesn't know about .NET control
types, it only knows about the controls that are in MSForms. If anything,
you will have to access this library (I believe it is in a separate library)
through COM interop, and add those elements.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Roger Zaugg" <ro*********@cbt.ch> wrote in message
news:15****************************@phx.gbl...
I've got a question about C# together with MS Word 2003.
I've got a C# applikation and I want to write any data into
Word. But how I can position this text without linebreaks.
I think it should work with a Textbox. And now the
question, how I can create a textbox in my C# - code and
position it in Word. (Without MSForms).

Nov 16 '05 #2
Hi Nicholas,

Sorry, I will specify my question. I know that I can't
position a c# textbox in word, I will create a Wordtextbox
in Word from my C# Code. Is it possible without MSForms or
how I can do this?

thx for answer
-----Original Message-----
Roger,

You won't be able to do this. Word doesn't know about ..NET controltypes, it only knows about the controls that are in MSForms. If anything,you will have to access this library (I believe it is in a separate library)through COM interop, and add those elements.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Roger Zaugg" <ro*********@cbt.ch> wrote in message
news:15****************************@phx.gbl...
I've got a question about C# together with MS Word 2003.
I've got a C# applikation and I want to write any data into
Word. But how I can position this text without linebreaks.
I think it should work with a Textbox. And now the
question, how I can create a textbox in my C# - code and
position it in Word. (Without MSForms).

.

Nov 16 '05 #3
Hi,

I got it... it's simple...
<worddocumentinstance>.shapes.addtextbox();

anyway.. thx for help
-----Original Message-----
Roger,

You won't be able to do this. Word doesn't know about ..NET controltypes, it only knows about the controls that are in MSForms. If anything,you will have to access this library (I believe it is in a separate library)through COM interop, and add those elements.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Roger Zaugg" <ro*********@cbt.ch> wrote in message
news:15****************************@phx.gbl...
I've got a question about C# together with MS Word 2003.
I've got a C# applikation and I want to write any data into
Word. But how I can position this text without linebreaks.
I think it should work with a Textbox. And now the
question, how I can create a textbox in my C# - code and
position it in Word. (Without MSForms).

.

Nov 16 '05 #4
Hi,

I am also working on some stuff similar to this. I want to access the word textbox in c#/asp.net application. There are two scenarios:

1) A machine which has VS2005 and MS Office 2000
The reference added for word is of version 9.0
and the code

aDoc.ActiveWindow.Document.Fields.Item(1).Locked = true;
works fine.

2) A machine which has VS2003 and MS Office 2003
The reference added for word is version 11.0
the same code as above doesnt work.
if we try accessing the data property as:
aDoc.ActiveWindow.Document.Fields.Item(1).Data;
It gives an error, "The field cannot contain data"

Can you please guide me as to how do I go about this.
What I want is access a word textbox, retrieve data from this and manipulate the same.

Thanks in advance
Venu M
Hi,

I got it... it's simple...
<worddocumentinstance>.shapes.addtextbox();

anyway.. thx for help
[color=blue]
>-----Original Message-----
>Roger,
>
> You won't be able to do this. Word doesn't know about[/color]
..NET control[color=blue]
>types, it only knows about the controls that are in[/color]
MSForms. If anything,[color=blue]
>you will have to access this library (I believe it is in a[/color]
separate library)[color=blue]
>through COM interop, and add those elements.
>
> Hope this helps.
>
>--
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
>"Roger Zaugg" <roger.zaugg@cbt.ch> wrote in message
>news:151e01c4bbfd$208ce0c0$a601280a@phx.gbl...[color=green]
>> I've got a question about C# together with MS Word 2003.
>> I've got a C# applikation and I want to write any data into
>> Word. But how I can position this text without linebreaks.
>> I think it should work with a Textbox. And now the
>> question, how I can create a textbox in my C# - code and
>> position it in Word. (Without MSForms).[/color]
>
>
>.
>[/color]
May 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mickeydisn | last post by:
Sub: C++ Word automation Extract text hello. I want extact text form a word document using a visual c++ programme. I have see a lot of documentation. and my analysis is that I must use a...
3
by: Mike MacSween | last post by:
Office 2000 From Access I've been starting an instance of word and doing a mail merge. Everything hunky-dory until I applied SP1 yesterday. Now this: dim wrd as Object set wrd =...
2
by: kids | last post by:
Does anybody know any reason which could cause Ms. word automation to crash? I try to call word automation to open a document and use find and replace function. For some reason it works but I...
4
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
1
by: Franck | last post by:
hello, I've found this tutorial for word automation in asp http://www.codeproject.com/aspnet/wordapplication.asp TO work I need to include the "Microsoft Word 10.0 Object Library dll" But...
4
by: Charles Law | last post by:
Does anyone know which files need to be distributed with a VB.NET application to enable Word automation on a m/c that does not have Word installed? Is this even possible / permissible? I currently...
2
by: johnc | last post by:
Hi all Been struggling to get word automation working via ASP on the server. The COM objects etc are installed and there already exists an Excel automation application which works, done by a...
1
by: Steve | last post by:
I am trying to figure out how I can center and size a word application active window within my vb.net form when the word document is open using automation so that the word window doesn't extend...
1
by: apondu | last post by:
Hi, can someone help me and provide me the information on how to supress the default action of the shortcut keys of word during word automation. I am using C#.Net I have written a code but...
0
by: Pramod Elig | last post by:
I developed this code which works fine in my current system which has office 2007, but when I run in word 2000 this doesn’t work. Can you please help me to code word automation using late binding. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.