• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 708
  • Last Modified:

creating a word document by WordApplication with custom template

Hello everyone,

anyone could suggest me how I can create a new word document from a custom template authenticated by user/password with WordApplication not visible so I can update only two places automatically then saving in another folder and printing as PDF?.....

Thanks to all!
Ciao,
Luigi
0
npuleio
Asked:
npuleio
  • 4
  • 3
1 Solution
 
Joanne M. OrzechManager, Document Services CenterCommented:
What language are you trying to write this program in?  
0
 
npuleioAuthor Commented:
Hello,

I use C++ Builder...
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Then you should be in that application zone. I will move the question for you.  I doubt if you're going to get any answers in the Word forum.

Joanne Orzech
MS Word MVP
EE Zone Advisor
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Joanne M. OrzechManager, Document Services CenterCommented:
Oh my apologies evilrix!  And my thanks for straightening this out....

Joanne
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> thanks for straightening this out
No worries, my pleasure.
0
 
npuleioAuthor Commented:
At least, anyone knows why if I write:

WordApplication->ActiveDocument->Shapes->AddTextEffect(msoTextEffect1, "text", "Arial Black", 1, msoFalse, msoFalse, 0, 0)

C++ Builder couldn't find a match?...
0
 
npuleioAuthor Commented:
OK here I am... I did some investigations and tests around Word.Application....

I have a template .dot which has read-password and write-password... how I would set the wordapplication as here:

WordDoc = WordDocs.OleFunction("Add", OleVariant(path_of_template_name.dot,...)

to pass automatically passwords?....
If I do

WordDoc = WordDocs.OleFunction("Add", OleVariant(path_of_template_name.dot,false, 1);
then
WordDoc.OlePropertySet("PasswordTemplate") = passwordtemplate;
WordDoc.OlePropertySet("WritePasswordTemplate") = passwordtemplate;

indeed executing OleFunction(...), Word opens and asks me directly the password instead of executing OlePropertySet... how I can figure that out?...

Thanks
Ciao
Luigi
0
 
npuleioAuthor Commented:
I've figured the solution at end:

since I was using PDFCreator which is an external component, I created a COM object with Delphi:

    PDFCreator := CreateOLEObject('PDFCreator.clsPDFCreator');

so I can set options of PDFCreator like password as in this example:

    PDFCreator.cOption('PDFOwnerPasswordString') := ownerpass;
    PDFCreator.cOption('PDFUserPasswordString') := ownerpass;

where ownerpass is a parameter variable passed by calling code, so that solved my issue. Hope that'd be useful to everyone...there's a complete Delphi example in PDFCreator sample though..

Thanks again to all.
Ciao
Luigi
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now