Solved

open word 2000 file and write in it.

Posted on 2002-05-30
7
179 Views
Last Modified: 2013-11-20
can anyone tell me the procedure to opening a new word 2000 file and write in it programatically.
i am using VC++ to do so.

ult
0
Comment
Question by:Ultpak
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
Please search in MSDN with "HOWTO: Use Automation to Run a Word Macro with Arguments"

(Don't forget to put quotes both sides)

You will get similar operations using word from that article


GOOD LUCK
0
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
Another Title is

"Automating Microsoft Office 97 and Microsoft Office 2000"

GOOD LUCK
0
 
LVL 3

Expert Comment

by:Crius
Comment Utility
I don't believe he is wanting to automate word 2000, I think he wants to just read/write to a Word 2000 file.

Is this a question regarding the format of a Word 2000 file?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 22

Accepted Solution

by:
ambience earned 200 total points
Comment Utility
Undertanding word file format is really an overkill when you can use Word to do the work for you, why is there automation afterall.

Here is a simple way to use Word
Import word type library, and add atleast the classes used in following code, _Application, Documents, _Document, Range etc.

COleVariant var;
_Application application;

var.vt = VT_ERROR;
var.scode = DISP_E_PARAMNOTFOUND;

application.CreateDispatch(_T("word.application"));
application.SetVisible(Visible);

Documents documents = application.GetDocuments();
_Document document = documents.Add(var,var);

Range range = document.Range(var,var);
range.InsertAfter(_T("hello"));void CMyReport::Close()

COleVariant savechanges = 1L;
application.Quit(savechanges,var,var);



0
 
LVL 3

Expert Comment

by:Crius
Comment Utility
True enough, automating Word is one of the easiest ways to read/write a Word file, but he didn't say he has Word 2000 anywhere. He may not have Word 2000. Since he is writing a program, he may distribute the program to people who do not have Word 2000.

That is my concern..

So, if you/your userbase have Word 2000, the best way to go is written above by others. If you do not, it will get more complex. Very complex in fact.

Here is an explanation of the Word 97 file format:
http://www.redbrick.dcu.ie/~bob/Tech/wword8.html

It that link doesn't scare you, and you really want to pursue opening and reading/writing Word files with your own program, this link:
http://www.wvware.com/wvInfo.html
contains much information on the Microsoft Office formats, including Word 2000, as well as freeware libraries/products to aid in your task.
0
 

Author Comment

by:Ultpak
Comment Utility
hi ambience

thanx it worked.
now i can write in word file.\
can u plese tell me, if i want to write at a specific position , i mean at the line 20 etc
what to do to do this.
thankx again.
ult
0
 

Author Comment

by:Ultpak
Comment Utility
thankx for helping me
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now