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

Programming Office with CSharp

I recently programming Word application/document in CSharp but got several
problem.
Any pointer to get started?
Mar 2 '07 #1
2 1587
Bob
Hi Alan,
Have just done a rather narrowly focused app but this may be of benefit to
you.
The app opens a word Doc and retrieves data out of the tables.
You need the OfficeXP PIAs that are compatible with the version of word docs
that you are using.
I am not an expert here, the copy I grabbed off the net produced Word
Object Library 10.0
apparently there is an 11.0 out there somewhere.
Anyway...
Reference the Microsoft Office Core and the Word library.
The object that gives you access to the text is the range object. Code
snippet shows opening a doc, getting references to the tables and picking up
one of the cells text.
HTH
Bob
word.Application mapp = new word.Application();

mapp.Visible = false;

object template = Type.Missing;

object newTemplate = Type.Missing;

object documentType = Type.Missing;

object optional = Type.Missing;

object visible = true;

object lTrue = true;

object lFalse = false;

object oDoc = sDoc;


word._Document doc2 = mapp.Documents.Open(ref oDoc, ref optional, ref lTrue,
ref lFalse, ref optional,

ref optional, ref optional, ref optional, ref optional,

ref optional, ref optional, ref lTrue, ref lFalse, ref optional, ref lTrue);

IEnumerator en = doc2.Tables.GetEnumerator();

word.Table t1;

word.Table t2;

word.Table t3;

en.MoveNext();

t1 = (word.Table)en.Current;

en.MoveNext();

t2 = (word.Table)en.Current;

en.MoveNext();

t3 = (word.Table)en.Current;

//Table1

myString= t1.Cell(1, 1).Range.Text;

"Alan T" <al*************@yahoo.com.auwrote in message
news:u0**************@TK2MSFTNGP05.phx.gbl...
>I recently programming Word application/document in CSharp but got several
problem.
Any pointer to get started?

Mar 2 '07 #2
"Alan T" <al*************@yahoo.com.auwrote in message
news:u0**************@TK2MSFTNGP05.phx.gbl...
>I recently programming Word application/document in CSharp but got several problem.
Any pointer to get started?

Maybe you could try to post Office related development questions in .NET, to the more
appropriate NG microsoft.pulic.vsnet.vstools.office.
I also would suggest you to start with a look at the office object model in MSDN and get a
text book on Office interop, http://safari.awprofessional.com/032...uggested=other
isn't that bad.

Willy.

Mar 2 '07 #3

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

Similar topics

4
by: Richard | last post by:
Office Addins are easy in .NET. Try this from Visual Studio's main menu: File New Project "Other Projects" Extensibility Projects Shared Addin Run the wizard and you're off...
90
by: Bret Pehrson | last post by:
This message isn't spam or an advertisement or trolling. I'm considering farming some of my application development to offshore shops (I'm in the US). I have absolutely *no* experience w/ this,...
12
by: Harry | last post by:
Hi, I am a system administrator who wants to move to Web App. development. I have read quite a lot articles regarding .net framework and visual studio.net and feel comfortable to start learning...
8
by: Dale | last post by:
I've searched Amazon and read probably 100 reviews but can't find what seems to be any book that is widely accepted as the definitive book on object oriented programming design and techniques. And...
6
by: Luke Vogel | last post by:
Hi all ... could someone point me in the right direction for programming office applications (specifically excel) using vb.net? Can vb.net replace or enhance VBA that comes with the office suite?...
5
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. ...
6
by: lucifer | last post by:
hi can some body point me to some good resources on port programming (serial n parallel) in general and in C# language i have searched the google but have not found anything to follow .please help...
18
by: subscribe | last post by:
How to conquer fear of programming?
0
by: athirukk | last post by:
Hi, I am doing Office (Word) programming in .Net with Microsoft.Office.Interop.Word. My C# code highlights the a text range in a Word document with the following snippet. ...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.