OLE to word
Hi to All
I am trying to convert the output of a Smartform to Microsoft Word using OLE. I want to know is there any possibility that we can make some text BOLD in word document. I mean i need output in word document formatted same as in Smartform output.
Thanks and Regards
Aditya
Hello,
Try this (all handles are of type ole2_object)
type-pools ole2 .
CREATE OBJECT word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
GET PROPERTY OF word 'documents' = documents.
CALL METHOD OF documents 'Add' = newdoc.
GET PROPERTY OF word 'Selection' = selection.
call method of selection 'TypeText'
exporting
#1 = 'Some data'.
call method of selection 'HomeKey'
exporting
#1 = 5
#2 = 1.
get property of selection 'Font' = font.
set property of font 'Bold' = 1.
Similar Messages
-
How to get the number of page by creating OLE microsoft word document
Hihi Experts,
I have generated a word document using ole in sap abap report.
May i know which command can i use to call the word object to get the number of page before closing the word document?
eg. call method of wordobj 'insertpagefield' ? and i need to require the page number in a variable eg. gv_pagenumber for other filtering purposes.
Thanks and Regards,
li Hui
Edited by: lihui lil on Aug 11, 2009 9:35 AM
Edited by: lihui lil on Aug 11, 2009 12:36 PMhi,
use the following code:
CALL METHOD OF gv_selection 'Information' = gv_curpage
EXPORTING
#1 = 3. " get current page number
CALL METHOD OF gv_selection 'TypeText'
EXPORTING
#1 = gv_curpage. "show current page number
CALL METHOD OF gv_selection 'TypeText'
EXPORTING
#1 = ' of '.
CLEAR gv_endpage.
CALL METHOD OF gv_selection 'Information' = gv_endpage
EXPORTING
#1 = 4. "get total page number
CALL METHOD OF gv_selection 'TypeText'
EXPORTING
#1 = gv_endpage. " show total page number
Edited by: VoonHan on Oct 13, 2009 7:35 AM -
Export To PDF with OLE Objects/Word
I got a report that has several OLE Objects that are each linked to a Word document.
Upon viewing the exported file, you notice that these objects have lost resolution and do not appear as clearly as they did in the report designer.
Upgraded to SP 4. The issues is still happening.
The issue happens when the linked word doc is right justified.
Any idea what causes this?
Using Crystal Reports 11.0.0.2495
Using Word 2003you may try following things:
1. Put crystal on the highest level of service pack(SP 4) and then check fro the results.
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
2.Suppress each section one by one (where these ole objects are placed) and then check whether a particular object is causing the trouble.Also, it will be clear if this issue is really due to ole objects or something else.
3.you are currently on release 1.If you have a chance to test this on release 2 or CR 2008 then it would be better.
Could you please explain what you exactly mean by fuzzy/distorted.I mean, do the objects/text appear blurd/misalligned or what. -
SAP OLE to Word Usage of Text Boxes & Arrow Diagrams
hi this my Macro recording in MS word How to use this as sap Code using SAP OLE
' Macro recorded 3/30/2009 by Nirmala
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 216#, _
72#, 108#, 54#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="Hma"
Selection.ShapeRange.Select
ActiveDocument.Shapes.AddLine(207#, 135#, 261#, 207#).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
Selection.ShapeRange.Flip msoFlipHorizontal
ActiveDocument.Shapes.AddLine(261#, 135#, 306#, 198#).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 153#, _
216#, 90#, 54#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="xys"
Selection.ShapeRange.Select
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 297#, _
207#, 81#, 63#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="lop"hi
Hthis is my sap program.. where to use this coding concept what are the data s to be declared
*DATA declarations
*--Include for OLE-enabling definitions
INCLUDE ole2incl .
*--Global variables *--Variables to hold OLE object and entity handles
DATA: word TYPE ole2_object , "OLE object handle
documents TYPE ole2_object , "Documents
doc TYPE ole2_object , "Documents
actdoc TYPE ole2_object , "Active document
application TYPE ole2_object , "Application D
options TYPE ole2_object , "Application options
actwin TYPE ole2_object , "Active window
actpan TYPE ole2_object , "Active pane
view TYPE ole2_object , "View
selection TYPE ole2_object , "Selection
font TYPE ole2_object , "Font
parformat TYPE ole2_object , "Paragraph format
tables TYPE ole2_object , "Tables
range TYPE ole2_object , "Range handle for various ranges
table TYPE ole2_object , "One table
table_border TYPE ole2_object , "Table border
cell TYPE ole2_object , "One cell of a table
paragraph TYPE ole2_object , "Paragraph
shapes TYPE ole2_object ,
logo TYPE ole2_object ,
textbox TYPE ole2_object,
find TYPE ole2_object,
picture(128) ,
gv_pos(5) TYPE n . "Position information for table
START-OF-SELECTION .
picture = 'D:\BMP\test.bmp'.
*-Creating OLE object handle variable
CREATE OBJECT word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
*-Setting object's visibility property
SET PROPERTY OF word 'Visible' = '1' .
* Adding documents
CALL METHOD OF word 'DOCUMENTS' = documents.
* Adding New page
CALL METHOD OF documents 'Add' = doc.
* Retrieving thre Property of Word for Alignment Changes
GET PROPERTY OF word 'Selection' = selection.
GET PROPERTY OF selection 'Font' = font .
GET PROPERTY OF selection 'ParagraphFormat' = parformat.
* Changes in Our Requirement
SET PROPERTY OF font 'Name' = 'Arial' .
SET PROPERTY OF font 'Size' = '20' .
SET PROPERTY OF font 'Bold' = '1' . "Not bold
SET PROPERTY OF font 'Italic' = '1' . "Italic
SET PROPERTY OF font 'Underline' = '1' . "Not underlined
* Paragraph Format 1 - Center 2 - Right 3 - Left
SET PROPERTY OF parformat 'Alignment' = '1'.
* Text to be displayed
CALL METHOD OF selection 'TypeText'
EXPORTING
#1 = 'Organisational Structure'.
*--Getting active document handle
GET PROPERTY OF word 'activedocument' = actdoc .
* To Save the document
CALL METHOD OF doc 'SaveAs'
EXPORTING
#1 = 'D:\TEMP\WordFormatOLE.doc'.
** To Quit the Document
CALL METHOD OF word 'Quit' . -
How to point at a word table using forms Ole and Word Document
Hello.
I like to know how to position at a word table and send data from a forms module using ole. I have done something similar before using bookmarks.It's easy and it works. My requirement now is to send data from a forms module to a word document, but this time, the word document will have bookmarks and a word table needs to be filled from data from the database. Just don't know how to get , access, reference the word table from forms.
I'm still using forms6i in C/S mode.
Help will be greatly appreciated ...!.
Best regards, Luis ...!Hi Luis,
The VBA code for updating the cell found at row three, column two of the first table, of the active document is as follows:
ActiveDocument.Tables(1).Cell(3,2).Select
Selection.TypeText("Hello, world!")I haven't time to convert it to OLE2, but hopefully it will at least give you an idea.
Eric Adamson
Lansing, Michigan -
OLE object using MS Word -- Unprotect/Protect document
Hi.
I'm on ECC6.0. I need a functionality to open a Word file (.rtf / .doc) on user's temp folder, unprotect it (like using Word's Tools -> Unprotect Document because, by default, the doc is protected w/o a password) to be able to protect it with a password, and then save it. I tried the following code but it's not working as I expected for the requirement:
TYPE-POOLS: ole2.
DATA:
lo_word TYPE ole2_object,
lo_worddocs TYPE ole2_object,
lo_worddoc TYPE ole2_object.
CREATE OBJECT lo_word 'WORD.Application'.
GET PROPERTY OF lo_word 'Documents' = lo_worddocs.
CALL METHOD OF lo_worddocs 'OPEN'
EXPORTING
#1 = lv_file_source.
GET PROPERTY OF lo_word 'ActiveDocument' = lo_worddoc.
CALL METHOD OF lo_worddoc 'UNPROTECT'.
CALL METHOD OF lo_worddoc 'PROTECT'
EXPORTING #1 = 'password'.
CALL METHOD OF lo_worddocs 'SAVE'.
CALL METHOD OF lo_worddocs 'CLOSE'.
In tcode SOLE, I found two relevant entries:
OLE application WORD.BASIC
Version number 6
CLSID {000209FE-0000-0000-C000-000000000046}
CLSID LibType {000209FE-0000-0000-C000-000000000046}
OLE object name WORDBASIC
Type Info key NO_TYPELIB
Include program
Language EN
Check authorization
Text Microsoft Word 6.0 Wordbasic
OLE application WORD97
Version number
CLSID {000209FF-0000-0000-C000-000000000046}
CLSID LibType
OLE object name
Type Info key NO_TYPELIB
Include program
Language
Check authorization
Text
Pls help me to the right track.
Thanks.Post Author: fwinter
CA Forum: .NET
We have the same problem. A page footer generated in Word, embedded in a CR-Report shows in the report viewer with overlapping characters. This is "a known limitation" we were told. Not really a problem, but when exported to PDF, the PDF also shows the overlapping characters and prints with overlapping characters as well. This is our problem!We've tried different fonts, different font- an pagesizes in Word, the "can grow" checkbox etc. We believe, the result is affected by the printer driver but cannot really find a way, to avoid the problem and get a clear print at all of our customers.Anyone figured out how to solve the problem? CA Support unfortunatly couldn't help We are using CR Merge Moduls XI R2 in our Report Viewer, Word 2003, Problem appears on local machines as well as on Citrix. -
OLE automation-To insert and print picture in word document
We are upgrading from 4.6C to ECC 6.0.One of our report program to print CV and insert photo in the word document works fine in version 4.6c.The methods to draw text box and insert photo to the required size don't work in ECC 6.0.seeking your advise.
I have attached the code:
Insert DrawingBox for CV Photo
call method of wordobj 'DrawTextbox'.
call method of wordobj 'DrawSetInsertToTextbox'..
call method of wordobj 'FormatDrawingObject'
exporting
#01 = '0' "Tab
#02 = '1' "FillColor
#03 = '1' "LineColor
#04 = '8' "FillPatternColor
#05 = '0' "FillPattern
#06 = '1' "LineType
#07 = '0' "LineStyle
#08 = '0.75 pt' "LineWeight
#09 = '0' "ArrowStyle
#10 = '0' "ArrowWidth
#11 = '- 1' "ArrowLength <--
#12 = '0' "Shadow
#13 = '0' "RoundCorners
#14 = '15.7 cm' "HorizontalPos
#15 = '1' "HorizontalFrom
#16 = '5.0 cm' "VerticalPos
#17 = '1' "VerticalFrom
#18 = '0' "LockAnchor
#19 = '4 cm' "Height
#20 = '4 cm' "Width
#21 = '1 pt' . "InternalMargin
if not path1 is initial.
call method of wordobj 'InsertPicture'
exporting #1 = path1 "Name
#2 = '1'. "LinkToFile
endif.
call method of wordobj 'DrawUnselect'.
call method of wordobj 'EndOfDocument'.
call method of wordobj 'InsertPara'.
Thanks..hi ,
use this for the custom pictures
Re: OLE / ms WORD / Create new document, insert image and print
use this for getting sap icons ...
Re: How to get SAP Icons as OLE Object -
How to open word document directly using ole2 and ole containers
Hello
i am using ole conatiners....in forms 6i. i want o open word document directly when i click a button....
i have tried host....ole but word opens .....i want the document to open at once.....
what should i use /set
plz tell by host command and ole2 as well
its urgent.....
thanksTry this code, Hope this will work.
declare
item_name varchar2(80) := 'letter';
item_id item;
verb_index_str VARCHAR(20);
verb_index PLS_INTEGER;
verb_cnt_str VARCHAR(20);
verb_cnt NUMBER;
verb_name VARCHAR(20);
loop_cntr NUMBER;
begin
item_id := Find_Item(item_name);
IF Id_Null(item_id)THEN
message('No such item: '||item_name);
ELSE
verb_cnt_str := Forms_OLE.Get_Verb_Count(item_id);
verb_cnt := TO_NUMBER(verb_cnt_str);
FOR loop_cntr in 1..verb_cnt LOOP
verb_name := Forms_OLE.Get_Verb_Name(item_id,loop_cntr);
-- message(verb_name);
-- message(loop_cntr|| ' '||verb_name);
IF verb_name = 'Open' or Verb_name = '?E?'THEN
EXEC_VERB(item_id,verb_name);
END IF;
end loop;
end if;
EXCEPTION
WHEN OTHERS THEN
MESSAGE('Error: '||TO_CHAR(SQLCODE)||' '||SQLERRM);
RAISE FORM_TRIGGER_FAILURE;
end; -
OLE using already existing Word-session
Hi!
I4m new in the Oracle-world and I4m sitting here trying to figure out how I from Forms 4.5 can see if there is an existing OLE2 object. I have a procedure (look below) that starts a Word-session but I don4t want to open a new session each time I4m calling the procedure in my form. Is there any way to see if an object already exists or some other smart way to do this?
Please help me if you know how!
/Anna
procedure StartWord is
begin
obj_hnd := ole2.create_obj ('Word.Basic');
ole2.invoke(obj_hnd, 'AppShow');
end;hi
I've got a problem !
I can't reach bookmarks into word via OLE
create_obj('WORD.BASIC')
If you know, would you help me?
Oliver -
Converting report output to a word document
Hi,
Can anyone pls help me by providing the program for converting displaying/inserting the internal table values along with the table frame aound the internal table(in the sense displaying the rows and columns lines) to the word document not in the excel format, instead of displaying in the report.
Thanks,
RaviHi Ravi,
see if this helps you in anyway:
REPORT OUTPUT IN WORD OR EXCEL
Re: OLE: ms word (Textbox)
Re: OLE and MS Word
Create MS-Word document (With format)
Regards,
Ravi -
Insert .bmp picture in word document
Hi All,
My Requirement is:
I need to insert one Bitmap image at the end of word document.
There is one MS Word document file and also there is one bitmap .bmp file.
My requirement is to read the file for change and insert the bitmap image (which is a signature) at the end.
Do I need to use OLE methods, if yes please guide how?
Secondly if there is any Sap standard function module for it?
Pls guide me on this.
Rishihi ,
use this for the custom pictures
Re: OLE / ms WORD / Create new document, insert image and print
use this for getting sap icons ...
Re: How to get SAP Icons as OLE Object -
ECC6Ehp5 abap call OLE have error
Dear All,
Our system from ECC5 upgrade to ECC6 Ehp5,Now we have some abap program cann't used it,We checked it,They are all call OLE write data to word.The program source code:
program zchangeword.
INCLUDE ole2incl .
DATA gs_word TYPE ole2_object . "OLE object handle
DATA gs_documents TYPE ole2_object .
DATA gs_actdoc TYPE ole2_object .
DATA gs_application TYPE ole2_object .
DATA gs_selection TYPE ole2_object .
DATA gs_bookmark TYPE ole2_object.
DATA gs_count TYPE ole2_object.
DATA gs_actwindow TYPE ole2_object.
DATA gs_actpane TYPE ole2_object.
DATA gs_view TYPE ole2_object.
DATA gs_font TYPE ole2_object.
DATA docpath TYPE string.
DATA l_dokst TYPE tdws-dokst.
docpath = 'c:\temp\20111124121443_TCDEV0101.doc'.
CREATE OBJECT gs_word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE 'Error while creating OLE object!' TYPE 'I'.
LEAVE PROGRAM .
ENDIF .
SET PROPERTY OF gs_word 'Visible' = '1' .
GET PROPERTY OF gs_word 'Documents' = gs_documents .
CALL METHOD OF
gs_documents
'Open'
EXPORTING
#1 = docpath.
GET PROPERTY OF gs_word 'ActiveDocument' = gs_actdoc .
CALL METHOD OF
gs_actdoc
'Unprotect'.
GET PROPERTY OF gs_actdoc 'Bookmarks' = gs_bookmark.
GET PROPERTY OF gs_bookmark 'Count' = gs_count.
GET PROPERTY OF gs_actdoc 'Application' = gs_application .
GET PROPERTY OF gs_application 'Selection' = gs_selection .
PERFORM replace USING 'Y0_NAME' 'TEST'.
PERFORM replace USING 'Y0_DATE' '2011.11.24'.
***关闭WORD文件
CALL METHOD OF
gs_actdoc
'Close'
EXPORTING
#1 = '-1'.
CALL METHOD OF
gs_word
'Quit'.
FREE OBJECT: gs_word,gs_documents,gs_actdoc,gs_application,gs_selection.&----*& Form replace
&----* text
----* -->P_FINDTEXT text
-->P_REPLACETEXT text
----FORM replace USING p_findtext
p_replacetext.
CALL METHOD OF
gs_selection
'GoTo'
EXPORTING
#1 = '-1'
#2 = 0
#3 = 0
#4 = p_findtext.
CALL METHOD OF
gs_selection
'MoveEnd'
EXPORTING
#1 = '5'
#2 = '1'.
CALL METHOD OF
gs_selection
'Delete'.
CALL METHOD OF GS_FIND 'ClearFormatting'.
CALL METHOD OF GS_FIND 'Execute'.
CALL METHOD OF
gs_selection
'TypeText'
EXPORTING
#1 = p_replacetext.
ENDFORM. " REPLACE
The code line "GET PROPERTY OF gs_word 'Documents' = gs_documents ."
If the ERP system is ECC5.0,the variable gs_documents can return value,
But system is ECC6 Ehp5 the variable gs_documents cann't return value,Then the program cann't change the word file,Who can help me?Dear GTREN ,
We use sole checked OLE application:
WORD.BASIC
WORD97
WORDPRO.APPLICATION
They are all same ECC5.0 system. -
We have a requirement from Tanzania Government,
Printing of document must be in readable format PDF/DOC which is to be processed via electronic signature device, so that all the values can be read then some digitial signature printing will be done.
We are printing all the document in printing via OTF (SAPSCRIPT), which has few LOGO's and data in tabular format with borders, so far the above said device does not support readable PDF that is been printed directly from SAP. So we need to convert the same in to word format, with all the formatting intact.
Ways to do the same,
1) Using 3'rd party PDF to word coverter which has been striked out.
2) OLE automation from SAP to WORD via mail merge
3) ??
My Question,
1 ) Can we configure any device in windows which will print documents in word, like PDF printer is configured, so that spool can be sent to such device and document can be printed.
2 ) Can we configure any device in SPAD, printer configuration, which will print documents in word, so that spool can be sent to such device and document can be printed.
3) Any Sample code would be welcomed.
4) If any one is doing the same, please let us know.
Regrads,
Dantham Conpolwedson
Edited by: Dantham Conpolwedson on Nov 15, 2010 10:32 AMHi,
Per my knowledge, I think:
1/ We cannot configure any device to print documents in word, instead you must use OLE to export documents to WORD manually.
2/ If you want sample of code in OLE to Word, please do a searching. I think a lot of answers appear.
It's all my opinion. Any other discussion please post.
Thanks, -
How to upgrade 6i form to 11g forms which includes OLE container ?
How to upgrade 6i form to 11g forms which includes OLE container ?
The migration assistant has no upgrade for that. You need to get a Javabean or PJC:
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e10394/items.htm#sthref207
I don't know what kind of OLE files you have, but if it's just Word and Excel, I would you use browser functionality instead and get the doc's via web.show_document. That, however, doesn't give you update possibility.
You can also use webutil file transfer to get the file to the PC, modify it there, and transfer back to the database.
Then you still have a problem. Documents uploaded via Forms OLE container are actually modified by Forms before they are stored in the database. So, don't throw away your 6i version yet.
You need to get all the stored documents out via Forms 6i and save them as a normal document on the file system. Then you can store them back in the database using some other tool, like dbms_lob or webutil's file transfer.
There are some related discussions on his forum, so just use the Search option, e.g.
Oracle Forms 10g and OLE Containers, word documents?
Edited by: InoL on Jul 13, 2011 9:32 AM -
It is still unsolved mystery.
Why OLE is not working after upgarde??
Pls check below thread & I have same problem.
My prog run fine in 46C but in ECC60..it's open MSWORD but did not include table.
I have done & checked all config settings related to SOLE. I thought it could be issue with SAPGUI since we have 620 but then why is running in 46C?
OLE: ms word (Textbox)
Any one has any idea?
Thanks,
ArpitPls see below code....
System is failing at bold statements.
FORM CALL_MSWORD.
DATA: WORDOBJ TYPE OLE2_OBJECT,
I TYPE I.
DESCRIBE TABLE ADRS_DATA LINES SY-TABIX.
CHECK SY-TABIX GT 0.
CREATE OBJECT WORDOBJ 'Word.Basic' .
CALL METHOD OF WORDOBJ 'FileNew' EXPORTING #1 = 'normal.dot'.
CALL METHOD OF WORDOBJ 'AppShow'.
<b>CALL METHOD OF WORDOBJ
'ToolsCreateLabels'
EXPORTING #1 = '0'
#2 = PETTY
#3 = PETNO
#4 = '0'
#5 = '0'
#6 = '0'.
</b>IF NOT PETFT IS INITIAL.
CALL METHOD OF WORDOBJ
'Font' "WBIK018729
'Schriftart' "WBIK018729
EXPORTING #1 = PETFT
#2 = PETCS.
ENDIF.
DO PSKET TIMES.
CALL METHOD OF WORDOBJ 'NextCell'.
ENDDO.
LOOP AT ADRS_DATA.
IF SY-TABIX NE 1 AND ADRS_DATA-XFELD EQ 'X'.
CALL METHOD OF WORDOBJ 'NextCell'.
IF NOT PETFT IS INITIAL.
CALL METHOD OF WORDOBJ
'Schriftart' "WBIK018729
'Font' "WBIK018729
EXPORTING #1 = PETFT
#2 = PETCS.
ENDIF.
ENDIF.
<b>
CALL METHOD OF WORDOBJ 'Insert' EXPORTING #1 = ADRS_DATA-LINE.
CALL METHOD OF WORDOBJ 'InsertPara'.
</b>
ENDLOOP.
ENDFORM. " CALL_MSWORD
Any clue??
I tried all ways..
Message was edited by:
Arpit Nigam
I solved the problem. Hence I am closing it.
Message was edited by:
Arpit Nigam
Maybe you are looking for
-
Dear All, I created one table like create table cls_lrn_tab_unique (F_no number unique UK_F_NO ); after performing some operations I want to delete the same. At that time i got following error. Please help me and tell what is the reason for the
-
Custom vibrations for incoming email, text, iMessage and Push
I need help to create my own custom vibrations for incoming text, email, and push notifications. I dislike short alert vibrating. Need long alert vibrating. How to set up it?
-
Hi, In TestStand
-
How we will multiple trans in bdc
how we will multiple trans in bdc what r the possile combination like one is bck n one in no disply mode how error can handle
-
Preferably this will be done with a JavaScript so it will be cross-platform. I need a script that will take objects on the artboard, give them a unique name (perhaps Object01 to Object99) for exampe and export each as a SWF file or a high-resolution