dbarra / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

docx with password #292

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Please provide any additional information below.
Can XDocReport make docx with random password protected?

Original issue reported on code.google.com by MrSo...@gmail.com on 4 Sep 2013 at 6:09

GoogleCodeExporter commented 8 years ago
No it's not a supported feature. 

Perhaps POI support that. If it supports it, perhaps you could generate docx 
with XDocReport and update it with POI to manage password?

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 Sep 2013 at 7:10

GoogleCodeExporter commented 8 years ago
The main idea of this is to add one tag to word/settings.xml like this:

<w:documentProtection w:edit="forms" w:enforcement="1" 
  w:cryptProviderType="rsaFull" 
  w:cryptAlgorithmClass="hash" 
  w:cryptAlgorithmType="typeAny" 
  w:cryptAlgorithmSid="4" 
  w:cryptSpinCount="50000" 
  w:hash="iMNelgcwaqcjZrxjRjtl0SRWLpY=" 
  w:salt="ik/s9VEtUXAkIehywGuyqQ=="/>

I guess, it have to be some kind of preprocessor?

Original comment by MrSo...@gmail.com on 4 Sep 2013 at 7:59

GoogleCodeExporter commented 8 years ago
Yes it's a great idea. It should be cool if you could contribute for this 
preprocessor.

I suggest you to do that with DOM (and not SAX, it should be more easy). You 
can see 
https://code.google.com/p/xdocreport/source/browse/document/fr.opensagres.xdocre
port.document.docx/src/main/java/fr/opensagres/xdocreport/document/docx/preproce
ssor/dom/DOMFontsPreprocessor.java which a preprocessor which changes the font 
name (font name is putted in the context).

You can see the use of this font preprocessor at 
https://code.google.com/p/xdocreport/source/browse?repo=samples#git%2Fsamples%2F
fr.opensagres.xdocreport.samples.docxandfreemarker%2Fsrc%2Ffr%2Fopensagres%2Fxdo
creport%2Fsamples%2Fdocxandfreemarker%2Ffonts%253Fstate%253Dclosed

It should really cool if you can contribute with this preprocessor. Thank's!

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 Sep 2013 at 8:13

GoogleCodeExporter commented 8 years ago
Other issue: if I'm using xdocreport for servlet, is there any url options 
(like .../servet?converter=PDF_XWPF) that can close this servlet window, after 
docx output done? Like you do it in demo 
http://xdocreport.opensagres.cloudbees.net/processReport.jsp, when button 
"Report" clicked.

Original comment by MrSo...@gmail.com on 4 Sep 2013 at 8:54

GoogleCodeExporter commented 8 years ago
Sorry I don't understand whan you mean with "close this servlet window". Please 
create a new post if it's not the same issue.

Thank's.

Original comment by angelo.z...@gmail.com on 4 Sep 2013 at 8:56

GoogleCodeExporter commented 8 years ago
When you click "Report" button in demo 
http://xdocreport.opensagres.cloudbees.net/processReport.jsp there appears 
"Save as" dialog, but new window of servlet after that is closed on background.

Original comment by MrSo...@gmail.com on 4 Sep 2013 at 9:01

GoogleCodeExporter commented 8 years ago
If I understand your need, you wish to download the pdf (and not display it in 
the web browser). If it that you must add in your http request dispatch=download

This feature is explained at  
https://code.google.com/p/xdocreport/wiki/DocxReportingWEBApplicationServlet#6._
Test_WEB_Reporting

Original comment by angelo.z...@gmail.com on 4 Sep 2013 at 9:16

GoogleCodeExporter commented 8 years ago
I added "dispatch=download" to url of my servlet, and it still give me "Save 
as" dialog, but the empty page is still on background, and not closing after 
dialog.

Original comment by MrSo...@gmail.com on 4 Sep 2013 at 9:57

GoogleCodeExporter commented 8 years ago
If you wish to do the same thing than our demo, you use dispatch=view or 
dispatch=download.

Otherwise I don't know how to manage your case.

Original comment by angelo.z...@gmail.com on 4 Sep 2013 at 10:19