OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Undo the Form Letter query

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Wed Dec 21, 2005 10:59 am    Post subject: Undo the Form Letter query Reply with quote

Everyone should know that the Mail Marge Wizard is usseless for complex task and page layouts.
Happly we have still the famous "Form Letter question" on printing ,at condition theres is a FormLeter Field present in the document. lProblem is: when the user had said that he not wonts to see this option again than he is forever in problems to uses Leter Form printing:
so:
Can we undo this never again thing with a macro using the API ?
Yes thanks to SergeM, Laurent, Danad and som peaces of code from DannyB.

anad wrote:

Under <ooo_user_install> look into Writer.xcu for:
Code:
Code:
<prop oor:name="AskForMerge" oor:type="xs:boolean">
    <value>false</value>
   </prop>

and change to:
Code:
Code:
<prop oor:name="AskForMerge" oor:type="xs:boolean">
    <value>true</value>
   </prop>


With the API it works like:

Code:
Sub ShowAskForMerge
   oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Writer/FormLetter/PrintOutput", False, True )
   MsgBox oConfigAccess.AskForMerge
End Sub

Sub MakeAskForMergeYES
   oConfigAccess = GetConfigAccess( "/org.openoffice.Office.Writer/FormLetter/PrintOutput", True, True, False )
   oConfigAccess.AskForMerge = True
   oConfigAccess.commitChanges()
End Sub
 

Function GetConfigAccess( ByVal cNodePath As String, ByVal bWriteAccess As Boolean,Optional bEnableSync, Optional bLazyWrite ) As Object
   If IsMissing( bEnableSync ) Then
      bEnableSync = True
   EndIf
   If IsMissing( bLazyWrite ) Then
      bLazyWrite = False
   EndIf

      oConfigProvider = GetProcessServiceManager().createInstanceWithArguments("com.sun.star.configuration.ConfigurationProvider",Array( MakePropertyValue( "enableasync", bEnableSync ) ) )
   
   If bWriteAccess Then
      cServiceName = "com.sun.star.configuration.ConfigurationUpdateAccess"
   Else
      cServiceName = "com.sun.star.configuration.ConfigurationAccess"
   EndIf
    rem Xray.Xray oConfigAccess
   
  oConfigAccess = oConfigProvider.createInstanceWithArguments( cServiceName, Array( MakePropertyValue( "nodepath", cNodePath ), MakePropertyValue( "lazywrite", bLazyWrite ) ) )
   
   GetConfigAccess() = oConfigAccess
End Function


Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function 


Can we call the "Form Letter printing option" with a macro using the API?
So far I could find out No...



Fernand[/code]
Back to top
View user's profile Send private message Send e-mail
hawstom
General User
General User


Joined: 21 Dec 2004
Posts: 33
Location: Arizona, USA

PostPosted: Fri Apr 14, 2006 12:46 am    Post subject: Reply with quote

In my 2.0.2 for XP, here is what I had to edit:

C:\Documents and Settings\Owner\Application Data\OpenOffice.org2\user\registry\data\org\openoffice\Office\Writer.xcu

<node oor:name="printOutput">
<prop oor:name="AskForMerge" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>

Close OpenOffice including the Quickstarter. Make sure it is closed.
_________________
Tom Haws
Find me at Google
Find peace in sacrificial love
Back to top
View user's profile Send private message
heerenveen
Newbie
Newbie


Joined: 26 Jun 2007
Posts: 1

PostPosted: Tue Jun 26, 2007 12:13 am    Post subject: Cant find the code needed Reply with quote

I have 2 witer.xcu files one on C one on E in both files i can not find:

<node oor:name="printOutput">
<prop oor:name="AskForMerge" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>

Do i need to add this to the code?
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Tue Jun 26, 2007 7:14 am    Post subject: Reply with quote

heerenveen,

To the best of my knowledge AskForMerge does not appear in the file until you have
checked the box to not show the dialog again. A that point the code above will restore
the dialog so you don't need to add anything to it.

hawstom's post shows what you would have to edit if you did it manually.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group