Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manupulatin Word Document using Delphi code

Status
Not open for further replies.

JPattom

Programmer
Aug 8, 2003
7
IN
Hi Experts
How to getrid of password coming to document made using password protected Template
I have certain template from wich i have to make word document but if the Tepmplate is password protected The same is also comming to the Word Document

i am using

uses
Word97;

procedure OpenNewDocumentWithTemplate(TemplateFileName: TFileName);
var
loleTemplateFileName: OleVariant;
lWordDocument: _Document;
lWordApplication: TWordApplication;
begin
loleTemplateFileName := 'PasswordprotectedTemplate.dot';
lWordDocument := WordApplication.Documents.Add(loleTemplateFilename, EmptyParam);

{ WordDocument.Unprotect('password');
this will work only if i know the password
geting password from the user is not possible since every thing has to work in batch process}

if WordDocument.TrackRevisions then
WordDocument.TrackRevisions := False;{ i will be able to do this if and only if wordDocuument is not password protected}

end;

The basic problem i am facing to make a document file from a password protected template without the password

I am also interested in solution to hide the Wordapplication
from the user while i am using it in the program

Thank fully
JPattom
 
Can't help with your first problem, but to hide the word application do:

WordApplication.Visible := false;
 
Hi lespaul
I got it worked, thax for the erliest reply, I badly need a solution for my first problem anybody out there can help me plz reply to the thread

Thankfully
JPattom
 
The password protection wouldn't be very good if you could override it through OLE. Why do the users need different passwords on documents that they want your process to read? Can you put a password you know on the template, so that you can get back into the documents?

Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
 
Hi Brian
The problem that i face is to make a Document using some template whose TrackRevision is protected through Password but this is not necessary for the document made using the template ( the TrackRevision will cause problem while I replace certain tags in the document made using template )

The template creator may be interested in protecting his template using a password but the document creator (document is made using my program) may not know the password so i cannot give a
lWordDocument.Unprotect(EmptyParam);
in my program since this will ask for password. the solution i need is "'TO MAKE An UNPROTECTED WordDocument Using Some Template Which is PROTECTED Using Some Password(May be only For TrackRevision)", so that the intrests of the template creator and the document creator is protected
Hope It is Clear
Thankfully
JPatom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top