OpenDocument4all - Info and tools about OpenDocument
Sunday, 05 February 2012
Home arrow Forum
Forum Statistics
Total user: 89
Total message: 179
Main Menu
Home
My Blog
AODL - Project
AODC - Project
OO Development & Info
Forum
About OpenDocument ...
Search
News
Contact Us
Login Form





Lost Password?
No account yet? Register
Sourceforge.net

SourceForge.net - Goto the project homepage
Project site on SF.net

 

Demand OpenDocument

 

Countomat Webcounter und Webstatistik (Statistik & Logfileanalyse, Counter)

OpenDocument4all-Forum

 
Copy & Paste by code
Date: 2007/03/16 21:47 By: Michael Herrmann Status: User  
Karma: 0  
Junior Boarder

Posts: 6
graphgraph
Hi,

i need a solution for moving a text-selection from one oo-document-window to another. I have openoffice documents by ...

ServiceManager = CreateObject("com.sun.star.ServiceManager")
Desktop = lv_objServiceManager.createInstance("com.sun.star.frame.Desktop")
Document = lv_objDesktop.loadComponentFromURL(url_Writer, "_blank", 0, args)

integrated with a setparent(handleDesktop, handleMdi) in my mdi-window.


I see multiple possibilities to transfer ...

1. sendmessage / wm_copy / wm_paste to oo-handle (dirty)
2. sendkeys.send("^c/^v") (more dirty)
3. insertTextContent (find no working example)

but no one works

1. The message SendMessage(lv_OO_hwnd_window, WM_PASTE, 0, 0) will not be received from the oo-desktop. The SendMessage(lv_OO_hwnd_window, WM_SYSCOMMAND, SC_CLOSE , 0) works, so the handle must be right. Has the document a other handle like the desktop ? Whats wrong ?

2. The sendkeys-method works, a text will be pasted to the destination-window, but multiple times. Example copy = "Text", paste =>"TextTextText..." The sendkey will only fired one time !!!

3. I can' find the right object for the insertTextContent-Method. What object (oSel) has a text selection ( .currentselection / .getViewCursor) to declare with the .insertTextContent(oVC,oSel,false) . There are many examples for objects=table/field ... but no one for a object that stores all received from getViewCursor.

Another requirement same problem. I want to store a text-selection in a Database and reload it, to insert the selection in a other oo-document.



Have i tomatoes on my eyes . I browse high and low trough the www. Is there a other easy solution i doesn't see ?

Best regards

Michael Herrmann
VB.Net
The administrator has disabled public write access.

Re:Copy & Paste by code
Date: 2007/03/19 21:12 By: Michael Herrmann Status: User  
Karma: 0  
Junior Boarder

Posts: 6
graphgraph
Hi Forum,

after checking the windows messages with spy++, the OO-Document has a different hwnd-handle as its own form. When i send a message or postmessage "WM-Paste" to the right handle nothing happens. Same test with Wordpad or Richtextbox or MS-Word works fine. So i think, a windowmessage will not help.

There is left over insertTextContent !

Who has a example for copy a text-selection ( include Grapics, Tables, Fileds ... ) from one oo-document-window into another. There must be a solution.

Please Help !!!

Best regards

Michael Herrmann
VB.Net
The administrator has disabled public write access.

Re:Copy & Paste by code
Date: 2007/03/28 14:26 By: Michael Herrmann Status: User  
Karma: 0  
Junior Boarder

Posts: 6
graphgraph
Hi,

i found a solution for my problem. The insertDocumentFromURL-Method inserts a oo-document at the cursorpostion. Easy if you know how ...

'VB.Net
Dim oText As Object = oDocument.getText
Dim oTextCursor As Object = oText.createTextCursor

'get postion of the shown cursor
Dim oViewCursor As Object
oViewCursor = oDocument.CurrentController.getViewCursor()

'set the postion of the shown cursor to oTextCursor
oTextCursor.gotoRange(oViewCursor, False)

Dim loadProps(-1) As Object
oTextCursor.insertDocumentFromURL("file:///D:/test.rtf", loadProps)


Best regards

Michael Herrmann
The administrator has disabled public write access.

Quick jump
Download area
Who's Online
We have 27 guests online
Polls
Should AODL and AODC also implement export as PDF and RTF?
 
Popular
© 2005 MamboZ. All rights reserved.