Invocar Word desde Forms

Quisiera saber como puedo desde forms invocar un documento word que tengo como plantilla pasandole los resultados de una select que devuelve los movimientos bancarios de los clientes.
Es realizar un report pero con word.

2 Respuestas

Respuesta

Meal kit deliveries have proudly taken the place of the services in the biggest demand. Today, when most offices and employees are working from home, they are even more relevant. Meal delivery saves your time for shopping, offers a great variety martha stewart meal kit review of menus, and is simply enjoyable. This review will focus on Martha and Marley Spoon meal delivery that stands beside Blue Apron, Purple Carrot, Green Chef, and Gobble. The service is founded by the famous cookbook authoress Martha Stewart who is also popularizing a healthy lifestyle. So, in this Marley Spoon review, we will delve into how good they are and what are their biggest pluses and minuses.

Respuesta
1
Deberas de Usar la librerio ole2, la documentacion de como usarla esta dentro del forms y en OYN podras encontrar ejemplos. No obstante debes de saber que este tipo de metodo no esta soportado en Forms9i ya que es propio de plataformas windows y en la web aunque funciona Oracle no lo soporta
Perdona pero soy novata en esto y mira en que lios me meten, ¿que es OYN? ¿hay mas documentacion a parte de la ayuda de forms?
Muchas gracias Reave.
Bueno OYN no es nada un error de escritura es OTN y es una direccion de internet http://otn.oracle.com donde puedes encontrar trucos y demas, no obstante te envio un texto obtenido de la web de soporte de Oracle mrtalink. Oracle.com explicando como relacionar forms con word, espero que te sirva de algo
OLE Automation of Word97 with Developer/2000 Forms
==================================================
INTRODUCTION:
=============
This bulletin explains the Word97 Object model and how Oracle Forms can make
use of the objects exposed by the Word97 OLE automation server. It contains
examples of automating an independent Word97 application as well as for
embedded or linked Word applications.
The bulletin does NOT talk about the OLE and OLE Automation features in Oracle
Forms. References 1 & 2 are a good source of information on this subject.
The focus here is on the Word97 Object model and it builds on the examples
provided in Reference 3 (OLE Automation Guide - Oracle Forms to Microsoft
Word95).
OLE/OLE2/OLE Automation concepts:
=================================
OLE(Object Linking and Embedding):
----------------------------------
It is the technology that allows a programmer to build software components
(Interoperalble objects) that adhere to a specific interface. This enables
you to create applications for users that allows one large document to consist
of a variety of smaller documents, each created in a different application.
OLE2:
-----
Extended the concept of OLE from compound documents to OLE Automation and a
number of other extensions to the original specification.
OLE Automation:
---------------
OLE server applications expose the properties and methods of their component
objects to other Windows applications. OLE client applications can
programmatically manipulate OLE server applications through reading/writing
their exposed properties and invoking their exposed methods. This process of
controlling of OLE server applications from OLE client applications is
known as 'OLE Automation'.
Object Models compared
======================
Word6/Word7(Word95)
-------------------
Word95 supported OLE Automation through a single 'Basic' object (Word. Basic).
This was the Word's own Macro language interpreter.
While Word95 could provide an object to another application (like Visual Basic
or Oracle Forms) for OLE Automation, it could not use OLE Automation to access
objects in other applications. In other words, applications that support OLE
Automation, such as Microsoft Excel95 or a Visual Basic application, could use
OLE Automation to access Word, but Word could not use OLE Automation to access
them.
Word97
------
In Word97 every element - documents, tables, paragraphs, bookmarks, fields and
so on can be represented by an object in Visual Basic. The Word97 object
model
is based on the VBA (Visual Basic for Applications) instead of the WordBasic
interpreter. The VBA is the edition of Visual Basic designed to provide
development capabilities by embedding itself directly inside the host
application
and is standard across the Office97 suite.
The primary difference between Visual Basic for Applications and WordBasic is
that whereas the WordBasic language consists of a flat list of approximately
900
Commands, Visual Basic consists of a hierarchy of objects, each of which
exposes
a specific set of methods and properties (similar to statements and functions
in
WordBasic). While most WordBasic commands can be run at any time, Visual Basic
only exposes the methods and properties of the available objects at a given
time.
You now have an OLE Automation object called 'Application' (Word. Application)
which contains methods and properties which return other top-level objects.
For
example, the 'ActiveDocument' property returns a 'Document' object.
This can be best visualised by looking at:
Microsoft Word Help
|
|-->Microsoft Word Visual Basic Reference
|
|-->Getting Started with Visual Basic
|
|-->Microsoft Word Objects
In this hyperlinked chart you can see individual objects as well as the Object
Collections (collection of similar objects).
Converting from WordBasic to Visual Basic
=========================================
Microsoft Word Visual Basic Reference
|
|-->Getting Started with Visual Basic
|
|-->Converting from WordBasic to Visual Basic
|
|-->Visual Basic Equivalents for WordBasic Commands
This section gives an alphabetical listing of the Visual Basic command
equivalents
for WordBasic commands.
The simplest example would be to display the main application window for Word
on
the screen -
Word95
------
DECLARE
-- Declare the OLE object
application OLE2.OBJ_TYPE;
BEGIN
-- Start WordBasic and make Word visible
application:=OLE2.CREATE_OBJ('Word.Basic');
OLE2.INVOKE(application, 'AppShow');
END;
Word97
------
If you look under 'Visual Basic Equivalents for WordBasic Commands' in the
on-line help, you can find the following entry for the 'AppShow' command:
AppShow => Application.Visible = True
So the modified code should be:
DECLARE
-- Declare the OLE object
application OLE2.OBJ_TYPE;
BEGIN
-- Create the Word.Application object and make Word visible
-- by setting the 'Visible' property to true
application:=OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(application, 'Visible', 1);
END;
OLE Automation examples with Word97
===================================
Example 1
---------
This example creates a new Word document, inserts some text in it and saves
its contents into a new file.
DECLARE
-- Declare the OLE objects
MyApplication OLE2.OBJ_TYPE;
MyDocuments OLE2.OBJ_TYPE;
MyDocument OLE2.OBJ_TYPE;
MySelection OLE2.OBJ_TYPE;
-- Declare handle to the OLE argument list
args OLE2.LIST_TYPE;
BEGIN
-- Create the Word.Application object and make Word visible
-- by setting the 'Visible' property to true
MyApplication:=OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(MyApplication, 'Visible', 1);
-- get a handle on Documents collection
MyDocuments:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Documents');
-- Add a new document to the Documents collection
Mydocument :=OLE2.INVOKE_OBJ(MyDocuments,'Add');
-- get a handle on Selection object
MySelection:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Selection');
-- Insert the text 'Hello Word97!' into word document
OLE2.SET_PROPERTY(MySelection, 'Text', 'Hello Word97!');
-- Save the document to the filesystem as EXAMPLE.DOC
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'D:\VPURI\DOCS\EXAMPLE.DOC');
OLE2.INVOKE(MyDocument, 'SaveAs', args);
OLE2.DESTROY_ARGLIST(args);
-- Close the document
OLE2.INVOKE(MyDocument, 'Close');
-- Release the OLE objects
OLE2.RELEASE_OBJ(MySelection);
OLE2.RELEASE_OBJ(MyDocument);
OLE2.RELEASE_OBJ(MyDocuments);
OLE2.RELEASE_OBJ(MyApplication);
END;
The Visual Basic code to achive the same functionality as above:
----------------------------------------------------------------
Sub Example1()
Set MyApplication = GetObject(, "Word.Application")
MyApplication.Visible = True
Set MyDocuments = MyApplication.Documents
Set MyDocument = MyDocuments.Add
Set MySelection = MyApplication.Selection
MySelection.Text = "Hello Word97!"
MyDocument.SaveAs FileName:="D:\VPURI\DOCS\EXAMPLE.DOC"
MyDocument.Close
Set MySelection = Nothing
Set MyDocuments = Nothing
Set MyApplication = Nothing
End Sub
Example 2
---------
This example illustrates the use of a predefined bookmark in a Word document
DECLARE
-- Declare the OLE objects
MyApplication OLE2.OBJ_TYPE;
MyDocuments OLE2.OBJ_TYPE;
MyDocument OLE2.OBJ_TYPE;
MySelection OLE2.OBJ_TYPE;
-- Declare handle to the OLE argument list
args OLE2.LIST_TYPE;
BEGIN
-- Create the Word.Application object and make Word visible
-- by setting the 'Visible' property to true
MyApplication:=OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(MyApplication, 'Visible', 1);
-- get a handle on Documents collection
MyDocuments:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Documents');
-- Open a new document
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'D:\VPURI\DOCS\EXAMPLE.DOC');
Mydocument :=OLE2.INVOKE_OBJ(MyDocuments,'Open',args);
OLE2.DESTROY_ARGLIST(args);
-- get a handle on Selection object
MySelection:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Selection');
-- Navigate to the Bookmark called 'MyBookmark'
-- VBA Syntax: Selection.Goto(What, Which, Count, Name)
-- Which, Count are optional and are specified only because the values
-- of the parameters are position dependent.
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, -1); -- What => constant 'wdGoToBookmark' = -1
OLE2.ADD_ARG(args,0); -- Which
OLE2.ADD_ARG(args,0); -- Count
OLE2.ADD_ARG(args, 'MyBookmark'); -- Name => bookmark name
OLE2.INVOKE(MySelection,'GoTo',args);
-- Insert some text at the bookmark location
OLE2.SET_PROPERTY(MySelection, 'Text', '** Inserting at MyBookmark **');
-- Release the OLE objects
OLE2.RELEASE_OBJ(MySelection);
OLE2.RELEASE_OBJ(MyDocument);
OLE2.RELEASE_OBJ(MyDocuments);
OLE2.RELEASE_OBJ(MyApplication);
END;
Visual Basic code:
------------------
Sub Example2()
Set MyApplication = GetObject(, "Word.Application")
MyApplication.Visible = True
Set MyDocuments = MyApplication.Documents
Set MyDocument = MyDocuments.Open(FileName:="D:\VPURI\DOCS\EXAMPLE.DOC")
Set MySelection = MyApplication.Selection
MySelection.GoTo What:=wdGoToBookmark, Name:="mybookmark"
'wdGoToBookmark = -1
MySelection.Text = "** Inserting at MyBookmark **"
Set MySelection = Nothing
Set MyDocuments = Nothing
Set MyDocuments = Nothing
Set MyApplication = Nothing
End Sub
Example 3
---------
If the tasks you want to perform in Word are completely self-contained and do
not require any parameters to be passed in from Oracle Forms, it may be
preferable to create a VBA macro within Word itself and invoke the macro via
OLE automation. The following example opens a word document EXAMPLE.DOC and
executes the VBA macro called 'MyMacro'
DECLARE
-- Declare the OLE objects
MyApplication OLE2.OBJ_TYPE;
MyDocuments OLE2.OBJ_TYPE;
MyDocument OLE2.OBJ_TYPE;
-- Declare handle to the OLE argument list
args OLE2.LIST_TYPE;
BEGIN
-- Create the Word.Application object and make Word visible
-- by setting the 'Visible' property to true
MyApplication:=OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(MyApplication, 'Visible', 1);
-- get a handle on Documents collection
MyDocuments:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Documents');
-- Open a new document
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'D:\VPURI\DOCS\EXAMPLE.DOC');
Mydocument :=OLE2.INVOKE_OBJ(MyDocuments,'Open',args);
OLE2.DESTROY_ARGLIST(args);
-- Execute the macro called 'MyMacro'
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'MyMacro');
OLE2.INVOKE(MyApplication,'Run',args);
OLE2.DESTROY_ARGLIST(args);
-- Release the OLE objects
OLE2.RELEASE_OBJ(MyDocument);
OLE2.RELEASE_OBJ(MyDocuments);
OLE2.RELEASE_OBJ(MyApplication);
END;
Example 4
---------
This example shows the automation of an embedded/linked word document -
it Runs a macro called 'MyMacro' in the embedded/linked document.
DECLARE
-- Declare the OLE objects
MyApplication OLE2.OBJ_TYPE;
MyDocument OLE2.OBJ_TYPE;
-- Declare handle to the OLE argument list
args OLE2.LIST_TYPE;
BEGIN
-- Open Word97 and activate it
FORMS_OLE.ACTIVATE_SERVER('OLEWORD.DOC');
-- Verb index 1 => Open the embedded document for editing
FORMS_OLE.EXEC_VERB('OLEWORD.DOC',1);
-- Get a handle on the Word document in the OLE container
MyDocument := FORMS_OLE.GET_INTERFACE_POINTER('OLEWORD.DOC');
-- Get a handle on the Application object
MyApplication := OLE2.GET_OBJ_PROPERTY(MyDocument,'Application');
-- Execute the macro called 'MyMacro'
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'MyMacro');
OLE2.INVOKE(MyApplication,'Run',args);
OLE2.DESTROY_ARGLIST(args);
-- Release the OLE objects
OLE2.RELEASE_OBJ(MyDocument);
OLE2.RELEASE_OBJ(MyApplication);
-- Close Word
FORMS_OLE.CLOSE_SERVER('OLEWORD.DOC');
END;
Conclusion:
-----------
This bulletin compared the Word97 and Word95 Object models. It explained
with the help of simple examples how you can make use of the new object
model to redesign your existing Oracle Forms Applications which can make
use of the advanced OLE Automation features in Word'97.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas