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

Merging documents

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
aloiziops
Power User
Power User


Joined: 07 Jul 2006
Posts: 52

PostPosted: Tue Nov 07, 2006 1:35 pm    Post subject: Merging documents Reply with quote

I created one template *.ott which is upload as a writer document. Then I use this template to merge documents.
In template I put line spacing equal 1.5cm. When I merge the documents the merged document should have all text with line spacing 1.5, but it doesn't have. could someone help?

I set also in template margin left and right to 2cm and 1cm respectivally, this works.
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


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

PostPosted: Wed Nov 08, 2006 11:19 am    Post subject: Reply with quote

When you set line spacing for presumably the Default paragraph style to 1.5" did you do so in the Stylist which actually changes the style globally or did you do Format (or right click) > Paragraph which only does direct formatting of the current paragraph?

My quick test brought the merged single spaced file in as 1.5" spacing. I did the merge with Insert > File.
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Wed Nov 08, 2006 11:28 am    Post subject: Re: Merging documents Reply with quote

aloiziops wrote:
Then I use this template to merge documents.

Sound similar to this thread: http://www.oooforum.org/forum/viewtopic.phtml?t=47334.

Regards
hol.sten
Back to top
View user's profile Send private message
aloiziops
Power User
Power User


Joined: 07 Jul 2006
Posts: 52

PostPosted: Thu Nov 09, 2006 5:12 am    Post subject: Reply with quote

I am using the ppience of code below to change Paragraph attributes, but I get error.

Code:
 XPropertySet xPropSet = (XPropertySet)
    UnoRuntime.queryInterface(XPropertySet.class,mxDoc.getText());
    //     from styles.CharacterProperties
    xPropSet.setPropertyValue("CharHeight", new Float(20.0));
    //     from styles.ParagraphProperties
    xPropSet.setPropertyValue("ParaLeftMargin", new Integer(500));   



This is the error:

Code:
com.sun.star.lang.IllegalArgumentException:
   at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:275)
   at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:141)
   at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:377)
   at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:346)
[/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: Thu Nov 09, 2006 6:24 am    Post subject: Reply with quote

I'm not much on reading Java code but it looks like you are get text and changing its properties which is direct formatting. To do what you want you need to get the paragraph style used by the target text and change its properties.

Here is an example in Basic.
Code:
Sub Main
oDoc = ThisComponent
oStyles = oDoc.getStyleFamilies()
oParaStyles = oStyles.getByName("ParagraphStyles")
thisStyle = oParaStyles.getByName("Text body")
thisStyle.setPropertyValue("CharHeight",20)
End Sub


Note that many paragraph styles are derived from, and therefore inherit most of their properties from, the Default paragraph (internally named Standard) so if you change a property of this style you may change a lot of other styles at the same time.


Last edited by JohnV on Thu Nov 09, 2006 9:22 am; edited 1 time in total
Back to top
View user's profile Send private message
aloiziops
Power User
Power User


Joined: 07 Jul 2006
Posts: 52

PostPosted: Thu Nov 09, 2006 7:45 am    Post subject: Reply with quote

I don't understand Basic. I need one example in Java. I tryed to map the basic code to java code, but didn't work.
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


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

PostPosted: Thu Nov 09, 2006 9:02 am    Post subject: Reply with quote

Serge,

You have made no mistakes it started out in Code Snippets, and you posted. I moved it to Writer where I initially thought it belonged. Then it became obvious that we were talking about a macro so I again moved it to Macros & API.

Now I'm going to clean the tread up by removing all the extra posts about where it belongs, where did it go, etc.

Hopefully someone can help the OP with sample Jave code because I can't.
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


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

PostPosted: Thu Nov 09, 2006 9:21 am    Post subject: Reply with quote

I think it's pretty obvious I don't know Java (actually I've forgotten what I use to know which certainly didn't include dealing with another program's API) but I have move this thread to the Macros & API section where you are more likely to get more help.

FWIW, "oDoc = ThisComponent" just gets the current document object as a whole and I'm sure your Java code does that in some manner or you couldn't work with the document. From that point onward my code simply creates other objects using a method available from the prior object until we have some paragraph style object. That object's setPropertyValue() method then changes one of the object properties but I'm sure you know that.

OOo Basic is very loose on syntax and I can get away with things Java won't permit. Very few things are case sensitive and I could get away with this for the last line of my code above by addressing a property directly.
thisStyle.CharHeight = 20

I have edited my code to add () after oDoc.getStyleFamilies which makes it a little more syntactically correct. A review of the case used for my methods and properties indicate all is correct (a matter of luck not intentional use of proper case).
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 Macros and API 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