Load currently opened OO files [C#]

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Load currently opened OO files [C#]

Postby nrkogo » Mon Dec 03, 2012 1:06 am

Hello! I'm working on a program that can merge currently opened OO files (let's say 3 writer docs into 1). I was wondering if there's any way to get this documents and load them into Xcomponents programmatically, so i can work with them (format, delete,etc.).

Thanks in advance.
OpenOffice 3.1 on Windows 7
nrkogo
 
Posts: 1
Joined: Mon Dec 03, 2012 12:50 am

Re: Load currently opened OO files [C#]

Postby Charlie Young » Mon Dec 03, 2012 4:07 am

nrkogo wrote:Hello! I'm working on a program that can merge currently opened OO files (let's say 3 writer docs into 1). I was wondering if there's any way to get this documents and load them into Xcomponents programmatically, so i can work with them (format, delete,etc.).

Thanks in advance.


I kind of hate to do this since you're working in c#, but I had something that does approximately what I guess you want in Basic - to load all opened components into an array, then loop through them until q is entered in the InputBox. You should be able to operate on the components whether or not they are in the active frame.

Code: Select all   Expand viewCollapse view
Sub LoopThroughComponents
   dim Comp as object
   Dim Comps(0) As Object
   dim x As Object
   dim i as Integer, c As Integer
   dim cmd as String
   
   Comp=StarDesktop.Components.CreateEnumeration
   c = 0
   do while Comp.hasMoreElements()
      x=Comp.NextElement()
      Redim Preserve Comps(c) As Object
      comps(c) = x
      c = c + 1   
   loop
   cmd = ""
   i = 0
   do while cmd <> "q" and cmd <> "Q"
      Comps(i).currentController.Frame.ContainerWindow.toFront()
      cmd = InputBox("q to quit","Enter Command")
      i = (i + 1) MOD c
   loop
      
End Sub

Apache OpenOffice 4.1.1
Windows XP
User avatar
Charlie Young
Volunteer
 
Posts: 1559
Joined: Fri May 14, 2010 1:07 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests