[Solved] How to sign a document via UNO

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
alex_lip
Posts: 4
Joined: Tue Aug 05, 2014 7:34 am

[Solved] How to sign a document via UNO

Post by alex_lip »

How to sign a document via UNO ??
Last edited by alex_lip on Fri Aug 08, 2014 8:35 am, edited 1 time in total.
OpenOffice 3.4 on Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to sign a document via UNO

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: How to sign a document via UNO

Post 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.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
alex_lip
Posts: 4
Joined: Tue Aug 05, 2014 7:34 am

Re: How to sign a document via UNO

Post by alex_lip »

Not work (( Error in last row.

Code: Select all

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

OpenOffice 3.4 on Windows XP
alex_lip
Posts: 4
Joined: Tue Aug 05, 2014 7:34 am

Re: How to sign a document via UNO

Post by alex_lip »

Work only with property ((((

Code: Select all

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

OpenOffice 3.4 on Windows XP
Post Reply