You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Lo...@log-net.com on 2012/01/06 18:06:23 UTC

read-only pptx

I'm investigating using slides that are read-only (not final).  I tracked 
the setting down to the <p:modifyVerifier> tag.  Does anyone have any 
experience with this tag (setting it with POI)?

Thanks,
Lou

Re: read-only pptx

Posted by Lo...@log-net.com.
Awesome.

Works like a charm.  I owe you a beer.

Thanks,
Lou

Yegor Kozlov <ye...@dinom.ru> wrote on 01/31/2012 04:17:50 AM:

> Yegor Kozlov <ye...@dinom.ru> 
> 01/31/2012 04:18 AM
> 
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> To
> 
> POI Users List <us...@poi.apache.org>
> 
> cc
> 
> Subject
> 
> Re: read-only pptx
> 
> Firstly, read Section 4.3.1.17 of the OOXML spec which describes the
> Modification Verifier element. You are going to set raw xml properties
> via XmlBeans and you should understand what they mean.
> 
> Setting modifyVerifier is easy:
> 
>         CTPresentation pr = ppt.getCTPresentation();
>         // get or create the modifyVerifier bean
>         CTModifyVerifier p = pr.isSetModifyVerifier() ?
> pr.getModifyVerifier() : pr.addNewModifyVerifier();
> 
>         // set document protection. Sample values are taken from 
theOOXML docs
> 
>         //the class of cryptographic algorithm used by this
> protection. Always HASH
>         p.setCryptAlgorithmClass(STAlgClass.HASH);
>         // the type of cryptographic algorithm used by this
> protection. Always TYPE_ANY
>         p.setCryptAlgorithmType(STAlgType.TYPE_ANY);
>         // the cryptographic hashing algorithm
>         p.setCryptAlgorithmSid(4); // SHA-1
>         // the hash value for the password.
>         p.setHashData("9oN7nWkCAyEZib1RomSJTjmPpCY="); //
> 
> You will have to use the full ooxml-schemas.jar instead of
> poi-ooxml-schemas.jar. You can build it yourself from POI svn or
> download from the Maven central repo:
> 
> http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22ooxml-schemas%22
> 
> Yegor
> 
> On Mon, Jan 30, 2012 at 7:02 PM,  <Lo...@log-net.com> wrote:
> > Totally lost on this.  It's presentation-level, so I'm guessing 
something
> > like:
> >
> >  CTPresentation ctp = ppt.getPresentation();
> >
> > And then I'm lost.
> >
> > -Lou
> >
> >
> >>On Fri, 6 Jan 2012, [hidden email] wrote:
> >>> I'm investigating using slides that are read-only (not final).  I
> >>> tracked the setting down to the <p:modifyVerifier> tag.  Does anyone
> >>> have any experience with this tag (setting it with POI)?
> >>
> >>For now, you'll need to drop down to the xmlbeans level (the CT 
objects).
> >
> >>You should find one for each of the xml elements, normally with a very
> >>similar name (it's all generated from the xml schema)
> >>
> >>Nick
> >
> > Louis.Masters@log-net.com wrote on 01/06/2012 12:06:23 PM:
> >
> >> Louis.Masters@log-net.com
> >> 01/06/2012 12:07 PM
> >>
> >> Please respond to
> >> "POI Users List" <us...@poi.apache.org>
> >>
> >> To
> >>
> >> user@poi.apache.org
> >>
> >> cc
> >>
> >> Subject
> >>
> >> read-only pptx
> >>
> >> I'm investigating using slides that are read-only (not final).  I
> > tracked
> >> the setting down to the <p:modifyVerifier> tag.  Does anyone have any
> >> experience with this tag (setting it with POI)?
> >>
> >> Thanks,
> >> Lou
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 

Re: read-only pptx

Posted by Yegor Kozlov <ye...@dinom.ru>.
Firstly, read Section 4.3.1.17 of the OOXML spec which describes the
Modification Verifier element. You are going to set raw xml properties
via XmlBeans and you should understand what they mean.

Setting modifyVerifier is easy:

        CTPresentation pr = ppt.getCTPresentation();
        // get or create the modifyVerifier bean
        CTModifyVerifier p = pr.isSetModifyVerifier() ?
pr.getModifyVerifier() : pr.addNewModifyVerifier();

        // set document protection. Sample values are taken from the OOXML docs

        //the class of cryptographic algorithm used by this
protection. Always HASH
        p.setCryptAlgorithmClass(STAlgClass.HASH);
        // the type of cryptographic algorithm used by this
protection. Always TYPE_ANY
        p.setCryptAlgorithmType(STAlgType.TYPE_ANY);
        // the cryptographic hashing algorithm
        p.setCryptAlgorithmSid(4); // SHA-1
        // the hash value for the password.
        p.setHashData("9oN7nWkCAyEZib1RomSJTjmPpCY="); //

You will have to use the full ooxml-schemas.jar instead of
poi-ooxml-schemas.jar. You can build it yourself from POI svn or
download from the Maven central repo:

http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22ooxml-schemas%22

Yegor

On Mon, Jan 30, 2012 at 7:02 PM,  <Lo...@log-net.com> wrote:
> Totally lost on this.  It's presentation-level, so I'm guessing something
> like:
>
>  CTPresentation ctp = ppt.getPresentation();
>
> And then I'm lost.
>
> -Lou
>
>
>>On Fri, 6 Jan 2012, [hidden email] wrote:
>>> I'm investigating using slides that are read-only (not final).  I
>>> tracked the setting down to the <p:modifyVerifier> tag.  Does anyone
>>> have any experience with this tag (setting it with POI)?
>>
>>For now, you'll need to drop down to the xmlbeans level (the CT objects).
>
>>You should find one for each of the xml elements, normally with a very
>>similar name (it's all generated from the xml schema)
>>
>>Nick
>
> Louis.Masters@log-net.com wrote on 01/06/2012 12:06:23 PM:
>
>> Louis.Masters@log-net.com
>> 01/06/2012 12:07 PM
>>
>> Please respond to
>> "POI Users List" <us...@poi.apache.org>
>>
>> To
>>
>> user@poi.apache.org
>>
>> cc
>>
>> Subject
>>
>> read-only pptx
>>
>> I'm investigating using slides that are read-only (not final).  I
> tracked
>> the setting down to the <p:modifyVerifier> tag.  Does anyone have any
>> experience with this tag (setting it with POI)?
>>
>> Thanks,
>> Lou

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: read-only pptx

Posted by Lo...@log-net.com.
Totally lost on this.  It's presentation-level, so I'm guessing something 
like:

 CTPresentation ctp = ppt.getPresentation();

And then I'm lost.

-Lou


>On Fri, 6 Jan 2012, [hidden email] wrote: 
>> I'm investigating using slides that are read-only (not final).  I 
>> tracked the setting down to the <p:modifyVerifier> tag.  Does anyone 
>> have any experience with this tag (setting it with POI)? 
>
>For now, you'll need to drop down to the xmlbeans level (the CT objects). 

>You should find one for each of the xml elements, normally with a very 
>similar name (it's all generated from the xml schema) 
>
>Nick 

Louis.Masters@log-net.com wrote on 01/06/2012 12:06:23 PM:

> Louis.Masters@log-net.com 
> 01/06/2012 12:07 PM
> 
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> To
> 
> user@poi.apache.org
> 
> cc
> 
> Subject
> 
> read-only pptx
> 
> I'm investigating using slides that are read-only (not final).  I 
tracked 
> the setting down to the <p:modifyVerifier> tag.  Does anyone have any 
> experience with this tag (setting it with POI)?
> 
> Thanks,
> Lou

Re: read-only pptx

Posted by Nick Burch <ni...@alfresco.com>.
On Fri, 6 Jan 2012, Louis.Masters@log-net.com wrote:
> I'm investigating using slides that are read-only (not final).  I 
> tracked the setting down to the <p:modifyVerifier> tag.  Does anyone 
> have any experience with this tag (setting it with POI)?

For now, you'll need to drop down to the xmlbeans level (the CT objects). 
You should find one for each of the xml elements, normally with a very 
similar name (it's all generated from the xml schema)

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org