Re: [python-win32] Excel / Word: setting properties

2018-03-02 Thread Niemann, Hartmut
Hello Tim,

workbook.CustomDocumentProperties.add(u'Document Confidentiality', False, 
4, u'Restricted', False)
for p in workbook.BuiltinDocumentProperties:
if p.Name == 'Keywords':
 p.Value = 'C_Restricted'

did the trick for me. Thank you for your support.

Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
Mobility Division
Rolling Stock
Standardization, Remote Control, Display
MO RS LM EN CCI SRD
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Mobil: +49 173 5342327
mailto:hartmut.niem...@siemens.com
www.siemens.com/ingenuityforlife<https://siemens.com/ingenuityforlife>

Von: python-win32 
[mailto:python-win32-bounces+hartmut.niemann=siemens@python.org] Im Auftrag 
von Tim Roberts
Gesendet: Freitag, 2. März 2018 09:13
An: Python-Win32 List
Betreff: Re: [python-win32] Excel / Word: setting properties

On Mar 2, 2018, at 12:07 AM, Niemann, Hartmut 
mailto:hartmut.niem...@siemens.com>> wrote:

print ('%r' % workbook.BuiltinDocumentProperties)

gives me

>

What can I do with such an object?

Are you checking the Word object model?  The BuiltinDocumetProperties method 
returns a DocumentProperties object.  I believe that is a collection of 
DocumentProperty objects.  So you should be able to say something like

for prop in workbook.BuiltinDocumentProperties:

—
Tim Roberts, t...@probo.com<mailto:t...@probo.com>
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Excel / Word: setting properties

2018-03-02 Thread Tim Roberts
On Mar 2, 2018, at 12:07 AM, Niemann, Hartmut  
wrote:
> 
> print ('%r' % workbook.BuiltinDocumentProperties)
> 
> gives me 
> 
> >
> 
> What can I do with such an object?

Are you checking the Word object model?  The BuiltinDocumetProperties method 
returns a DocumentProperties object.  I believe that is a collection of 
DocumentProperty objects.  So you should be able to say something like

for prop in workbook.BuiltinDocumentProperties:

— 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Excel / Word: setting properties

2018-03-02 Thread Niemann, Hartmut
Hello Tim!

print ('%r' % workbook.BuiltinDocumentProperties)

gives me 

>

What can I do with such an object?

Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
Mobility Division
Rolling Stock
Standardization, Remote Control, Display
MO RS LM EN CCI SRD
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Mobil: +49 173 5342327
mailto:hartmut.niem...@siemens.com

www.siemens.com/ingenuityforlife


-Ursprüngliche Nachricht-
Von: python-win32 
[mailto:python-win32-bounces+hartmut.niemann=siemens@python.org] Im Auftrag 
von Tim Roberts
Gesendet: Mittwoch, 28. Februar 2018 18:20
An: Python-Win32 List
Betreff: Re: [python-win32] Excel / Word: setting properties

Niemann, Hartmut wrote:
>
>  
>
> How do I set the [Excel workbook] standard property "Keywords" to 
> "C_Restricted" and the user property "Document Confidentiality" to 
> "Restricted"?
>

The Document object should have a BuiltinDocumentProperties collection and a 
CustomDocumentProperties collection that you can query and manipulate.  You'll 
have to discover whether the properties you need to tweak are builtin or not.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Excel / Word: setting properties

2018-02-28 Thread Tim Roberts
Niemann, Hartmut wrote:
>
>  
>
> I create an excel document using the COM interface.
>
>  
>
> Now I need to set two properties to be compatible with a new company rule:
>
>  
>
> “[the tool] uses MS Office standard (‘Keyword’) and custom (‘Document
> Confidentiality’) properties. so if your code is able
>
> to preset values to these properties [everything should work]”
>
>  
>
> How do I set the [Excel workbook] standard property “Keywords” to
> “C_Restricted” and the user property “Document Confidentiality” to
> “Restricted”?
>

The Document object should have a BuiltinDocumentProperties collection
and a CustomDocumentProperties collection that you can query and
manipulate.  You'll have to discover whether the properties you need to
tweak are builtin or not.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Excel / Word: setting properties

2018-02-28 Thread Niemann, Hartmut
Hi!

I create an excel document using the COM interface.

Now I need to set two properties to be compatible with a new company rule:

"[the tool] uses MS Office standard ('Keyword') and custom ('Document 
Confidentiality') properties. so if your code is able
to preset values to these properties [everything should work]"

How do I set the [Excel workbook] standard property "Keywords" to 
"C_Restricted" and the user property "Document Confidentiality" to "Restricted"?

Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
Mobility Division
Rolling Stock
Standardization, Remote Control, Display
MO RS LM EN CCI SRD
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Mobil: +49 173 5342327
mailto:hartmut.niem...@siemens.com
www.siemens.com/ingenuityforlife
[www.siemens.com/ingenuityforlife]
Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Jim Hagemann Snabe; 
Vorstand: Joe Kaeser, Vorsitzender; Roland Busch, Lisa Davis, Klaus Helmrich, 
Janina Kugel, Cedrik Neike, Michael Sen, Ralf P. Thomas; Sitz der Gesellschaft: 
Berlin und München, Deutschland; Registergericht: Berlin Charlottenburg, HRB 
12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32