Solved

How can I exchange data between PB and WinWord (No OLE).

Posted on 2001-07-31
7
623 Views
Last Modified: 2013-12-26
How can I send a data from PowerBuilder to WinWord in .DOC file. and from Winword to PowerBuilder. (please no OLE).
0
Comment
Question by:Bhatti
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:AFI
Comment Utility
Hello, I know you don't want OLE but I use the OLE with good results and the object that PB not suport I add in a macro that is called inside my PB App.... Ok... sorry but I express my self better in spanish... Bien la otra solución es utilizar DDE (dynamic data exchange).... You can find this in Word Help (Visual Basic)

Códigos de campo: campos DDE y DDEAuto
{ DDE NombreAp NombreArchivo [LugarRef] }
{ DDEAUTO NombreAp NombreArchivo [LugarRef] }

Establece un vínculo de intercambio dinámico de datos (DDE) con un documento creado en otro programa basado en Windows. Si hay nueva información disponible en un documento vinculado, el campo DDE insertará la nueva información cuando se actualice. El campo DDEAUTO inserta automáticamente la información nueva en el momento en que esté disponible. Si Word no puede establecer el vínculo cuando intente actualizar un campo DDE o DDEAUTO, se conservará el resultado anterior.

Instrucción Explicación
NombreAp Nombre de otro programa que admita DDE.
"NombreArchivo" Nombre de un archivo u otro elemento reconocible por el programa NombreAp. Si la posición incluye un nombre de archivo largo con espacios, debe ir entre comillas. Reemplace las barras diagonales inversas por barras diagonales inversas dobles para indicar la ruta de acceso, por ejemplo:
"C:\\Mis documentos\\Manual.doc"
 
[LugarRef] Parte del archivo o elemento especificado, como por ejemplo un rango de celdas de una hoja de cálculo de Microsoft Excel o un marcador de un documento de Word.
0
 
LVL 4

Author Comment

by:Bhatti
Comment Utility
Dear AFI,

I have no problem with OLE. But I am searching a solution without OLE. If you have any idea please let me know.


THANKS


Best regards

Bhatti
0
 
LVL 2

Expert Comment

by:AFI
Comment Utility
Hello Bhatti, the following code you can find it in PB Help, is about Excel but is similar to Word... If I made an example in Word I will send you....

These statements open a channel to the active spreadsheet REGION.XLS in Microsoft Excel and set handle to the handle to the channel.

long handle

handle = OpenChannel("Excel", "REGION.XLS")

The following example opens a DDE channel to Excel and requests data from three spreadsheet cells. In the PowerBuilder application, the data is stored in the string array s_regiondata. The client window for the DDE conversation is w_ddewin.

long handle

string s_regiondata[3]

handle = OpenChannel("Excel", "REGION.XLS",  &

Handle(w_ddewin))
GetRemote("R1C2", s_regiondata[1], handle,  &
          Handle(w_ddewin))
GetRemote("R1C3", s_regiondata[2], handle,  &
          Handle(w_ddewin))
GetRemote("R1C4", s_regiondata[3], handle,  &
          Handle(w_ddewin))
CloseChannel(handle, Handle(w_ddewin))
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Author Comment

by:Bhatti
Comment Utility
How to do in EXCEL I know. I am searching solution with WIN-World

Best Regards


Bhatti
0
 
LVL 2

Accepted Solution

by:
AFI earned 200 total points
Comment Utility
Ok, my friend I made this little example to use Word with DDE.

//command button cb_1 (clicked!)
Long      ll_hwnd, ll_hchannel
String     ls_wserver = "WinWord"
Integer li_close


Run("winword.exe") //Word most be open

ll_hwnd = Handle(Parent) //Optional

ll_hchannel = OpenChannel(ls_wserver, "System", ll_hwnd)
If ll_hchannel = 0 Then
   MessageBox("Advertencia", "Servidor no encontrado.")
   Return
End If

ExecRemote("[FileNewDefault]", ll_hchannel, ll_hwnd)
ExecRemote("[Insert(~"Hola~")]", ll_hchannel, ll_hwnd)

li_close = CloseChannel(ll_hchannel, ll_hwnd)

If li_close <> 1 Then
   MessageBox("Error", "No se cerro el canal de comunicación")
End If

I use PB6.5 and MSWord 2000, to make this example.
0
 
LVL 4

Author Comment

by:Bhatti
Comment Utility
I shall try and let you know soon.


Best regards


Bhatti
0
 
LVL 4

Author Comment

by:Bhatti
Comment Utility
Thanks AFI.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now