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

Changing user's properties in the documents with a macro

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


Joined: 30 Apr 2012
Posts: 12

PostPosted: Wed May 16, 2012 12:33 pm    Post subject: Changing user's properties in the documents with a macro Reply with quote

Pls Help ! Need a macro . How to connect the two documents(writer). Edit the user's properties of the first document. So the user's properties in the second document have changed too

sorry for my english Embarassed
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu May 17, 2012 8:33 pm    Post subject: Reply with quote

Do you mean this information:
Code:
Sub GetDocumentProperties
  Dim oProps
  Dim oDocProps
  Dim s$
  Dim i As Integer
  Dim prop
  oDocProps = ThisComponent.getDocumentProperties()
  s = s & "Author = " & oDocProps.Author & CHR$(10) & _
      "AutoLoadSecs = " & oDocProps.AutoloadSecs & CHR$(10) & _
      "AutoLoadURL = " & oDocProps.AutoloadURL & CHR$(10) & _
      "CreationDate = " & DateSTructToString(oDocProps.CreationDate) & _
      CHR$(10) & _
      "Default Target = " & oDocProps.DefaultTarget & CHR$(10) & _
      "Description = " & oDocProps.Description & CHR$(10) & _
      "EditingCycles = " & oDocProps.EditingCycles & CHR$(10) & _
      "EditingDuration = " & oDocProps.EditingDuration & CHR$(10) & _
      "Generator = " & oDocProps.Generator & CHR$(10) & _
      "Language = (" & oDocProps.Language.Country & ", " & _
      oDocProps.Language.Language & ", " & _
      oDocProps.Language.Variant & ")" & CHR$(10) & _
      "ModificationDate = " & _
      DateSTructToString(oDocProps.ModificationDate) & CHR$(10) & _
      "ModifiedBy = " & oDocProps.ModifiedBy & CHR$(10) & _
      "PrintDate = " & DateSTructToString(oDocProps.PrintDate) & _
      CHR$(10) & _
      "PrintedBy = " & oDocProps.PrintedBy & CHR$(10) & _
      "Subject = " & oDocProps.Subject & CHR$(10) & _
      "TemplateDate = " & _
      DateSTructToString(oDocProps.TemplateDate) & CHR$(10) & _
      "TemplateName" & oDocProps.TemplateName & CHR$(10) & _
      "TemplateURL" & oDocProps.TemplateURL & CHR$(10) & _
      "Title = " & oDocProps.Title & CHR$(10) & _
      ""
  oProps = oDocProps.UserDefinedProperties
  s = s & "Info 1 = " & oProps.[Info 1] & CHR$(10) & _
          "Info 2 = " & oProps.[Info 2] & CHR$(10) & _
          "Info 3 = " & oProps.[Info 3] & CHR$(10) & _
          "Info 4 = " & oProps.[Info 4]
  MsgBox s
  If LBound(oDocProps.Keywords) <= UBound(oDocProps.Keywords) Then
    MsgBox Join(oDocProps.Keywords, CHR$(10)),,"Keywords"
  End If
  s = ""
  Dim oStats : oStats = oDocProps.DocumentStatistics
  For i = LBound(oStats) To UBound(oStats)
    s = s & oStats(i).Name & " = " & oStats(i).Value & CHR$(10)
  Next
  MsgBox s
End Sub

Function DateSTructToString(ostruct) As String
  DateSTructToString() = ostruct.Month & "/" & _
     ostruct.Day & "/" & ostruct.Year & " at " & _
     ostruct.Hours & ":" & ostruct.Minutes & ":" & _
     ostruct.Seconds & "." & ostruct.HundredthSeconds
End Function

_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Sat May 19, 2012 10:13 am    Post subject: Reply with quote

mmm...no .

I mean . Use a macro , and after Info1 in document one = info1 in document two . ))

It's possible?Rolling Eyes
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Sat May 19, 2012 11:08 am    Post subject: Reply with quote

Do you know how to program?

You need to get the document properties as shown in the macro above from both document and then assign values from one to the other.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Sun May 20, 2012 8:49 am    Post subject: Reply with quote

Not good , I started to learn programming a month ago Embarassed
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Sun May 20, 2012 7:10 pm    Post subject: Reply with quote

OK, so what is obvious to a "programmer" is not so obvious to a non-programmer....

I assumed you had two documents (referenced by variables or similar) and you just needed to know how to copy from one to the other. Now, I assume that you require an entire system that is able to say something like .... Choose source document, choose target document, now copy from source to target.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
as1234
General User
General User


Joined: 30 Apr 2012
Posts: 12

PostPosted: Sun May 20, 2012 10:50 pm    Post subject: Reply with quote

Quote:
I assumed you had two documents (referenced by variables or similar) and you just needed to know how to copy from one to the other. Now, I assume that you require an entire system that is able to say something like .... Choose source document, choose target document, now copy from source to target.


Yep , this very similar to what I need
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