Solved

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

Posted on 2001-07-31
7
630 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
ID: 7451671
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
ID: 7465864
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
ID: 7466062
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Author Comment

by:Bhatti
ID: 7466165
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
ID: 7466471
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
ID: 7470131
I shall try and let you know soon.


Best regards


Bhatti
0
 
LVL 4

Author Comment

by:Bhatti
ID: 7483165
Thanks AFI.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven import project error 7 136
Eclipse for PHP 1 111
What is Codeanywhere used for and can EE provide example of use 9 220
The line on IDE 4 91
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

828 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