Awesome. Works like a charm. I owe you a beer.
Thanks, Lou Yegor Kozlov <[email protected]> wrote on 01/31/2012 04:17:50 AM: > Yegor Kozlov <[email protected]> > 01/31/2012 04:18 AM > > Please respond to > "POI Users List" <[email protected]> > > To > > POI Users List <[email protected]> > > 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, <[email protected]> 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 > > > > [email protected] wrote on 01/06/2012 12:06:23 PM: > > > >> [email protected] > >> 01/06/2012 12:07 PM > >> > >> Please respond to > >> "POI Users List" <[email protected]> > >> > >> To > >> > >> [email protected] > >> > >> 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: [email protected] > For additional commands, e-mail: [email protected] >
