Page 1 of 1

[Solved] How to sign a document via UNO

PostPosted: Tue Aug 05, 2014 2:37 pm
by alex_lip
How to sign a document via UNO ??

Re: How to sign a document via UNO

PostPosted: Tue Aug 05, 2014 2:57 pm
by Villeroy

Re: How to sign a document via UNO

PostPosted: Thu Aug 07, 2014 2:41 pm
by hanya
If you call methods from com.sun.star.security.XDocumentDigitalSignatures to sign to some document, Digital Sign dialog is opened. So it seems no way to do it without GUI.

Re: How to sign a document via UNO

PostPosted: Fri Aug 08, 2014 7:58 am
by alex_lip
Not work (( Error in last row.
Code: Select all   Expand viewCollapse view
sub sign_doc
sFileURL = "c:\0_foxpro_oo\test.odt"
   
  sf = CreateUnoService("com.sun.star.embed.StorageFactory")
  oDocStorage = sf.createInstanceWithArguments(Array(sFileURL, 4))
  oDDS = CreateUnoServiceWithArguments("com.sun.star.security.DocumentDigitalSignatures", _
             Array("1.2", True))
oDDS.signDocumentContent(oDocStorage, Null)
   
end sub


Re: How to sign a document via UNO

PostPosted: Fri Aug 08, 2014 8:02 am
by alex_lip
Work only with property ((((
Code: Select all   Expand viewCollapse view
sub sign_doc
sFileURL = "c:\0_foxpro_oo\test.odt"
  Dim aProps(0) as new com.sun.star.beans.PropertyValue
  aProps(0).Name = "StorageFormat"
  aProps(0).Value = "ZipFormat"
 
  sf = CreateUnoService("com.sun.star.embed.StorageFactory")
  oDocStorage = sf.createInstanceWithArguments(Array(sFileURL, 4,  aProps))
  oDDS = CreateUnoServiceWithArguments("com.sun.star.security.DocumentDigitalSignatures", _
             Array("1.2", True))
oDDS.signDocumentContent(oDocStorage, Null)

end sub