OLE/Word 97

It seems that the interface to Word 97 has TOTALLY changed!! I'm trying
to create a new document from an existing template, so I'm assuming I
need to use the AttachedTemplate virtual attribute of the _Document
class. How do I set this attribute to the template I want to use?? I
haven't worked with virtual attributes, so I'm having a rough time! Any
help would be greatly appreciated.
Doug Scurr
Information Services
Piper Jaffray Companies
[email protected]
(612) 342-1748
Thanks
Doug
If you are not the intended recipient, please notify the Sender.
Non-business opinions may not reflect opinions of Piper Jaffray
Companies (PJC). Distribution or other use of this information
is prohibited without written consent from the author.
PJC reserves the right to monitor all e-mail.
------------------------------------------------------------------------------

It seems that the interface to Word 97 has TOTALLY changed!! I'm trying
to create a new document from an existing template, so I'm assuming I
need to use the AttachedTemplate virtual attribute of the _Document
class. How do I set this attribute to the template I want to use?? I
haven't worked with virtual attributes, so I'm having a rough time! Any
help would be greatly appreciated.
Doug Scurr
Information Services
Piper Jaffray Companies
[email protected]
(612) 342-1748
Thanks
Doug
If you are not the intended recipient, please notify the Sender.
Non-business opinions may not reflect opinions of Piper Jaffray
Companies (PJC). Distribution or other use of this information
is prohibited without written consent from the author.
PJC reserves the right to monitor all e-mail.
------------------------------------------------------------------------------

Similar Messages

  • OLE-Word with table

    Hi,
    i use OLE-Word to create a table in a word document and fill them.
    That's work OK, but i will position the table on a specific Positon on the page.
    Position shell be horizontal 7 and vertical 8.
    I have tried it with recording in word, bot i don't know the statements in ABAP.
    Has anyone an idea to solve it or an example?
    thanks.
    Regards, Dieter.
    Edited by: Dieter Gröhn on Jun 16, 2008 10:34 AM

    Here my code:
    REPORT ZGRO_MS_WORD_OLE_FORMLETTER_T0.
    *--Include for OLE-enabling definitions
    INCLUDE OLE2INCL .
    *--Global variables
    *--Variables to hold OLE object and entity handles
    DATA GS_WORD        TYPE OLE2_OBJECT . "OLE object handle
    DATA GS_DOCUMENT    TYPE OLE2_OBJECT . "Documents
    DATA GS_ACTIV_DOC   TYPE OLE2_OBJECT . "Active document
    DATA GS_APPLICATION TYPE OLE2_OBJECT . "Application
    DATA GS_OPTIONS     TYPE OLE2_OBJECT . "Application options
    DATA GS_ACTWIN      TYPE OLE2_OBJECT . "Active window
    DATA GS_ACTPAN      TYPE OLE2_OBJECT . "Active pane
    DATA GS_VIEW        TYPE OLE2_OBJECT . "View
    DATA GS_SELECTION   TYPE OLE2_OBJECT . "Selection
    DATA GS_FONT        TYPE OLE2_OBJECT . "Font
    DATA GS_PARFORMAT   TYPE OLE2_OBJECT . "Paragraph format
    DATA GS_TABLES      TYPE OLE2_OBJECT . "Tables
    DATA GS_RANGE       TYPE OLE2_OBJECT . "Range handle for various ranges
    DATA GS_TABLE       TYPE OLE2_OBJECT . "One table
    DATA GS_BORDER      TYPE OLE2_OBJECT . "Table border
    DATA GS_CELL        TYPE OLE2_OBJECT . "One cell of a table
    DATA GS_PARAGRAPH   TYPE OLE2_OBJECT . "Paragraph
    START-OF-SELECTION .
      PERFORM WORD_APPLIKATION.
      PERFORM TABELLE_ERSTELLEN.
      PERFORM TABELLE_ZELLE.
      FREE OBJECT GS_WORD .
    FORM WORD_APPLIKATION.
    *--Creating OLE object handle variable
      CREATE OBJECT GS_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 GS_WORD 'Visible' = '1' .
    *--Opening a new document
      GET PROPERTY OF GS_WORD 'Documents' = GS_DOCUMENT.
      CALL METHOD OF GS_DOCUMENT 'Add' .
    *--Getting active document handle
      GET PROPERTY OF GS_WORD 'ActiveDocument' = GS_ACTIV_DOC .
    *--Getting applications handle
      GET PROPERTY OF GS_ACTIV_DOC 'Application' = GS_APPLICATION .
    *--Setting the measurement unit
      GET PROPERTY OF GS_APPLICATION 'Options' = GS_OPTIONS .
      SET PROPERTY OF GS_OPTIONS 'MeasurementUnit' = '1' . "CM
    *--Getting handle for the selection which is here the character at the
    *--cursor position
      GET PROPERTY OF GS_APPLICATION 'Selection' = GS_SELECTION .
      GET PROPERTY OF GS_SELECTION 'Font' = GS_FONT .
      GET PROPERTY OF GS_SELECTION 'ParagraphFormat' = GS_PARFORMAT .
    ENDFORM.                    "word_applikation
    FORM TABELLE_ERSTELLEN.
    *--Getting entity handles for the entities on the way
      GET PROPERTY OF GS_ACTIV_DOC 'Tables' = GS_TABLES .
      GET PROPERTY OF GS_SELECTION 'Range' = GS_RANGE .
    *--Adding a table
      CALL METHOD OF GS_TABLES 'Add' = GS_TABLE
           EXPORTING #1 = GS_RANGE
                     #2 = '1' "Number of rows
                     #3 = '1'. "Number of columns
    *--Setting border attribute
      GET PROPERTY OF GS_TABLE 'Borders' = GS_BORDER .
      SET PROPERTY OF GS_BORDER 'Enable' = '0' .                "0 o. 1
    DATA GS_ROWS   TYPE OLE2_OBJECT.
      GET PROPERTY OF GS_TABLE 'Rows' = GS_ROWS.
      SET PROPERTY OF GS_ROWS  'WrapAroundText' = '1'.
      SET PROPERTY OF GS_ROWS  'HorizontalPosition' = '3'.
      SET PROPERTY OF GS_ROWS  'RelativeHorizontalPosition' = '1'.
      SET PROPERTY OF GS_ROWS  'VerticalPosition' = '8'.
      SET PROPERTY OF GS_ROWS  'RelativeVerticalPosition' = '1'.
      set property of GS_ROWS  'AllowOverlap'     = '0'.
    ENDFORM.                    "Tabelle_erstellen
    FORM TABELLE_ZELLE.
    *--Getting cell coordinates
      CALL METHOD OF GS_TABLE 'Cell' = GS_CELL
        EXPORTING #1 = '1'
        #2 = '1'.
    *--Getting the range handle to write the text
      GET PROPERTY OF GS_CELL 'Range' = GS_RANGE .
    *--Filling the cell
      SET PROPERTY OF GS_RANGE 'Text' = 'Test' .
    ENDFORM.                    "TABELLE_Zelle
    in Word i record and get this:
    Sub Makro1()
    ' Makro1 Makro
    ' Makro aufgezeichnet am 16.06.2008
        ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _
            1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
            wdAutoFitFixed
        With Selection.Tables(1)
            If .Style <> "Tabellengitternetz" Then
                .Style = "Tabellengitternetz"
            End If
            .ApplyStyleHeadingRows = True
            .ApplyStyleLastRow = True
            .ApplyStyleFirstColumn = True
            .ApplyStyleLastColumn = True
        End With
        With Selection.Tables(1).Rows
            .WrapAroundText = True
            .HorizontalPosition = CentimetersToPoints(2)
            .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
            .DistanceLeft = CentimetersToPoints(0.25)
            .DistanceRight = CentimetersToPoints(0.25)
            .VerticalPosition = CentimetersToPoints(8)
            .RelativeVerticalPosition = wdRelativeVerticalPositionPage
            .DistanceTop = CentimetersToPoints(0)
            .DistanceBottom = CentimetersToPoints(0)
            .AllowOverlap = False
        End With
    End Sub
    i will translate it in abap. how can i do it.
    i tried something in FORM TABELLE_ERSTELLEN but i can see the table, but i don't get the right position.
    Any idea?
    thanks.
    Regards, Dieter

  • ABAP OLE Word - Delete last page

    Dear all,
    I have a SAP program which prints some documents in Microsoft Word by using ABAP OLE Objects.
    I use a template to take the main context, and after that I send some variables in order to populate the word document.
    The problem is when I create the new word document, I paste the template text in a new document, but at the end I have always an empty page. I don't know how to delete this final page, I don't find the corresponding OLE method to do it.
    I have found a method to cut a line, but the problem is that line is also empty, and I cannot cut it.
    Could anyone help me?
    Many thanks in advance and best regards.

    Hi,
    post some code lines. Format as code, use preview.
    Regards,
    Clemens

  • How to set imgae/photo size in a OLE word

    Hi,
    I am developing a OLE object to extract data from SAP system into a MS Office word documnet.
    I am downloading image from application server to presentation server and displaying it on word documnet using
    create object g_wordobj 'Word.Basic' .
    call method of g_wordobj 'InsertPicture'
                       exporting #1 = l_picture_file        " file path
                                 #2 = '1' .                             " link to file *
    User requirement is to restrict the image size to height 130 pixel and width 100 pixel.
    How can i resize the imgae?

    Hi,
    Yes it is possible to resize a picture in OLE:
      data : lo_picture     type ole2_object.
      data : lw_height      type i .
      data : lw_width       type i .
    Build image
    call method of g_wordobj 'InsertPicture' = lo_picture
    exporting #1 = l_picture_file
    #2 = '1' . " link to file *
      Get property of picture
        clear : lw_height, lw_width.
        get property of lo_picture 'Height' = lw_height.
        get property of lo_picture 'Width'  = lw_width.
        call function 'FLUSH'.
    *change the height and width values and after
      Change the property
          set property of lo_picture 'LockAspectRatio' = -1.
          set property of lo_picture 'Height' = lw_height.
          set property of lo_picture 'Width' = lw_width.
          call function 'FLUSH'.

  • Poor image quality when displaying OLE Word doc stored in BLOB

    Hello,
    I am migrating some CR Reports from VB6 to VB.NET 2008.
    The reports retrieves Word documents that is stored in BLOB column on SQL Server 2005.
    If CR.NET (same behaviour with 2005 and 2008 versions) renders the word document, the quality is really bad. Looks like an ugly moire effect. The characters below 8pt font size are hardly readable.  I have already set the option "use full color-depth" in the report options.
    If the same word doc is rendered with CR that's included in VB6, it shows a clear and sharp output - the same as displayed in word.
    Where is the difference in handling Word OLE between those two CR versions?
    Is there anything I can do to improve the quality with CR.NET?
    Regards,
    Stefan

    Hello, Stefan;
    Is this a Windows or Web application?
    Visual Basic 6.0 shipped with Crystal Reports 4.6 Visual Studio .NET 2005 ships with Crystal Reports 10.2 and VS .NET 2008 with version 10.5.
    The Crystal Reports application was rewritten in versions 5.0 and  9.0 and a great many changes were made - among them different options for including OLE Objects. See the [Note 1218374|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] for useful new functionality. I tested a report with a linked Word document and it viewed well through Visual Studio .NET 2008.
    Is it possible support for the  the Word format as a BLOB field in MS SQL Server has changed over time. What method is used to create the document as a BLOB field?
    Are you using the bundled version included with Visual Studio .NET? In the article recommending the property 'Retain Original Image Color Depth', there is a note:
    Note: This option only functions with the full version of Crystal Reports 9 or 10. This option does not function with the .NET Report Designer.
    Originally the issue was fixed but only in a full versions of Crystal Reports Developer, not in the versions bundled with Visual Studio .NET.
    I tested with a linked Word document and see some degradation when there is an image in the Word Document but not in the text itself.
    Elaine

  • Poor image quality when displaying OLE Word object in PDF

    MS Word 2007 OLE object in Crystal Reports XII R2 designer...looks OK in designer.  When we export to PDF, the image quality has been degraded significantly.  Anybody had this issue before?  tried replacing usp10.dll with one found in CommonFiles folder, that did not help.

    Hi Mark,
    See if this [kbase |http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313333333633383336%7D.do] - SAP Note 1213686 - Certain objects do not appear clearly when exporting to PDF/RTF/Word formats - article resolves the issue. It's for CR 9 so you'll have to browse to the CR XI registry structure.
    Otherwise try all of the patches for CR XI R2:
    Keep your Keycode and then uninstall XI R2, unless you are on SP 4 then just apply SP 5 and 6:
    https://smpdl.sap-ag.de/~sapidp/012002523100011802732008E/crxir2_sp4_full_build.exe
    https://smpdl.sap-ag.de/~sapidp/012002523100013876392008E/crxir2win_sp5.exe
    https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe
    Thank you
    Don

  • Ole Word Automation, Remove Table Borders

    Hi All,
    I have created a new word document with a table of 3 rows and 3 columns using the ole. I want to remove vertical lines. The borders property enable only shows or disables the borders. I want to remove any border I want.
    I recorded a macro at Word. But I couldn't managed to adopt in ABAP. I will be glad if you can help. Thanks.
    Word Macro :
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
    ABAP code :
      GET PROPERTY OF gs_actdoc 'Tables' = gs_tables .
      GET PROPERTY OF gs_selection 'Range' = gs_range .
      CALL METHOD OF gs_tables 'Add' = gs_table
      EXPORTING
      #1 = gs_range
      #2 = '3'
      #3 = '3'.
      GET PROPERTY OF gs_table 'Borders' = gs_table_border .
      SET PROPERTY OF gs_table_border 'Enable' = '1' . "With border

    Hi,
    I've found a solution.
    After creating table and enabling borders, you can select cells and delete borders.
      GET PROPERTY OF gs_actdoc 'Tables' = gs_tables .
      GET PROPERTY OF gs_selection 'Range' = gs_range .
    **--Adding a table with 3 rows and 3 columns
      CALL METHOD OF gs_tables 'Add' = gs_table
      EXPORTING
      #1 = gs_range " Handle for range entity
      #2 = '3' "Number of rows
      #3 = '3'. "Number of columns
    **--Setting border attribute for the table
      GET PROPERTY OF gs_table 'Borders' = gs_table_border .
      SET PROPERTY OF gs_table_border 'Enable' = '1' . "With border
      CALL METHOD OF gs_table 'Cell' = gs_cell1
      EXPORTING
      #1 = '1' "first row
      #2 = '1'. "first column
      CALL METHOD OF gs_cell1 'BORDERS' = borders
        EXPORTING
        #1 = '2'. "1 top, 2 left, 3 bottom, 4 right (border)
      SET PROPERTY OF borders 'LineStyle' = '0'.

  • ABAP OLE Word for reading a file

    Hi,
    I am looking for the method or property to get the word document content to send it to the clipboard.
    All I found an OLE is for writing but not for reading and I need it to read a file.
    Someone got an idea?
    Thanks a lot.
    David

    Hi David, the ad on top sucks.
    it's already almost 10 years old but SAP did not develop anything new un this area (as far as I know),
    [Desktop Office Integration (BC-CI) H|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf]
    copy_selection
    You use this method to copy marked text from the office document to the clipboard:
    CALL METHOD document->copy_selection
    EXPORTING no_flush = no_flush
    IMPORTING error = error
    retcode = retcode.
    paste_clipboard
    You use this method to insert the contents of the clipboard at the current cursor position. The
    clipboard contents are inserted as fixed text; there is no link to the object:
    CALL METHOD document->paste_clipboard
    EXPORTING no_flush = no_flush
    IMPORTING error = error
    retcode = retcode.
    select_all
    You use this method to mark all text in the office document.
    CALL METHOD document->select_all
    EXPORTING no_flush = no_flush
    IMPORTING error = error
    retcode = retcode.
    I hope you were looking for this.
    Regards,
    Clemens

  • OLE Word , table not exists

    hi, I use the following program to add table in word but in some system it's OK and in other system it's not.
    Is there a configuration issue on it?
    Best regards,
    Blake Le
    REPORT  ZLEB_TEST_WORD.
    *--Include for OLE-enabling definitions
    INCLUDE OLE2INCL .
    *--Global variables
    *--Variables to hold OLE object and entity handles
    DATA GS_WORD TYPE OLE2_OBJECT . "OLE object handle
    DATA GS_DOCUMENTS TYPE OLE2_OBJECT . "Documents
    DATA GS_ACTDOC TYPE OLE2_OBJECT . "Active document
    DATA GS_APPLICATION TYPE OLE2_OBJECT . "Application
    DATA GS_OPTIONS TYPE OLE2_OBJECT . "Application options
    DATA GS_ACTWIN TYPE OLE2_OBJECT . "Active window
    DATA GS_ACTPAN TYPE OLE2_OBJECT . "Active pane
    DATA GS_VIEW TYPE OLE2_OBJECT . "View
    DATA GS_SELECTION TYPE OLE2_OBJECT . "Selection
    DATA GS_FONT TYPE OLE2_OBJECT . "Font
    DATA GS_PARFORMAT TYPE OLE2_OBJECT . "Paragraph format
    DATA GS_TABLES TYPE OLE2_OBJECT . "Tables
    DATA GS_RANGE TYPE OLE2_OBJECT . "Range handle for various ranges
    DATA GS_TABLE TYPE OLE2_OBJECT . "One table
    DATA GS_TABLE_BORDER TYPE OLE2_OBJECT . "Table border
    DATA GS_CELL TYPE OLE2_OBJECT . "One cell of a table
    DATA GS_PARAGRAPH TYPE OLE2_OBJECT . "Paragraph
    DATA GV_POS(5) TYPE N . "Position information for table
    CREATE OBJECT GS_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 GS_WORD 'Visible' = '1' .
    *--Opening a new document
    GET PROPERTY OF GS_WORD 'Documents' = GS_DOCUMENTS .
    CALL METHOD OF GS_DOCUMENTS 'Add' .
    *--Getting active document handle
    GET PROPERTY OF GS_WORD 'ActiveDocument' = GS_ACTDOC .
    *--Getting applications handle
    GET PROPERTY OF GS_ACTDOC 'Application' = GS_APPLICATION .
    *--Setting the measurement unit
    GET PROPERTY OF GS_APPLICATION 'Options' = GS_OPTIONS .
    SET PROPERTY OF GS_OPTIONS 'MeasurementUnit' = '1' . "CM
    *--Getting handle for the selection which is here the character at the
    *--cursor position
    GET PROPERTY OF GS_APPLICATION 'Selection' = GS_SELECTION .
    GET PROPERTY OF GS_SELECTION 'Font' = GS_FONT .
    GET PROPERTY OF GS_SELECTION 'ParagraphFormat' = GS_PARFORMAT .
    *--Setting font attributes
    SET PROPERTY OF GS_FONT 'Name' = 'Arial' .
    SET PROPERTY OF GS_FONT 'Size' = '10' .
    SET PROPERTY OF GS_FONT 'Bold' = '0' . "Not bold
    SET PROPERTY OF GS_FONT 'Italic' = '1' . "Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF GS_PARFORMAT 'Alignment' = '2' . "Right-justified
    CALL METHOD OF GS_SELECTION 'TypeText'
    EXPORTING
    #1 = 'This is an OLE example!'.
    *--Setting the view to the main document again
    SET PROPERTY OF GS_VIEW 'SeekView' = '0' . "Main document view
    *--Reseting font attributes for the title
    SET PROPERTY OF GS_FONT 'Name' = 'Times New Roman' .
    SET PROPERTY OF GS_FONT 'Size' = '16' .
    SET PROPERTY OF GS_FONT 'Bold' = '1' . "Bold
    SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF GS_PARFORMAT 'Alignment' = '1' . "Centered
    CALL METHOD OF GS_SELECTION 'TypeText'
    EXPORTING
    #1 = TEXT-000.
    *--Advancing cursor to the new line
    CALL METHOD OF GS_SELECTION 'TypeParagraph' .
    *--Getting entity handles for the entities on the way
    GET PROPERTY OF GS_ACTDOC 'Tables' = GS_TABLES .
    GET PROPERTY OF GS_SELECTION 'Range' = GS_RANGE .
    *--Adding a table with 3 rows and 2 columns
    CALL METHOD OF GS_TABLES 'Add' = GS_TABLE
    EXPORTING
    #1 = GS_RANGE " Handle for range entity
    #2 = '3' "Number of rows
    #3 = '2'. "Number of columns
    *--Setting border attribute for the table
    GET PROPERTY OF GS_TABLE 'Borders' = GS_TABLE_BORDER .
    SET PROPERTY OF GS_TABLE_BORDER 'Enable' = '1' . "With border
    **--Filling the table with dummy data
    **--Reseting font attributes for table content
    *SET PROPERTY OF GS_FONT 'Name' = 'Garamond' .
    *SET PROPERTY OF GS_FONT 'Size' = '11' .
    *SET PROPERTY OF GS_FONT 'Bold' = '0' . "Not bold
    *SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    *SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    **--Getting cell coordinates
    *CALL METHOD OF GS_TABLE 'Cell'
    *EXPORTING
    *#1 = '1' "first row
    *#2 = '1'. "first column
    **--Getting the range handle to write the text
    *GET PROPERTY OF GS_CELL 'Range' = GS_RANGE .
    **--Filling the cell
    *SET PROPERTY OF GS_RANGE 'Text' = 'abinash' .
    **--Getting cell coordinates
    *CALL METHOD OF GS_TABLE 'Cell' = GS_CELL
    *EXPORTING
    *#1 = '3' "third row
    *#2 = '2'. "second column
    **--Getting the range handle to write the text
    *GET PROPERTY OF GS_CELL 'Range' = GS_RANGE .
    **--Filling the cell
    *SET PROPERTY OF GS_RANGE 'Text' = 'OLE' .
    **--Advancing the cursor to the end of the table
    *GET PROPERTY OF GS_TABLE 'Range' = GS_RANGE .
    *GET PROPERTY OF GS_RANGE 'End' = GV_POS .
    *SET PROPERTY OF GS_RANGE 'Start' = GV_POS .
    *CALL METHOD OF GS_RANGE 'Select' .
    **--Skip some lines
    *DO 3 TIMES .
    *CALL METHOD OF GS_SELECTION 'TypeParagraph' .
    *ENDDO.
    **--Reseting font attributes for ordinary text
    *SET PROPERTY OF GS_FONT 'Name' = 'Times New Roman' .
    *SET PROPERTY OF GS_FONT 'Size' = '12' .
    *SET PROPERTY OF GS_FONT 'Bold' = '0' . "Not bold
    *SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    *SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    **--Setting paragraph format attribute
    *SET PROPERTY OF GS_PARFORMAT 'Alignment' = '3' . "Justified
    **--Indent the paragraph once
    *GET PROPERTY OF GS_SELECTION 'Paragraphs' = GS_PARAGRAPH .
    *CALL METHOD OF GS_PARAGRAPH 'Indent' .
    *CALL METHOD OF GS_SELECTION 'TypeText'
    *EXPORTING
    *#1 = TEXT-002.
    FREE OBJECT GS_WORD .

    Now try your code on a system which dose not have word installed. It should fail.
    To fix the problem every system should have word components installed.
    Thanks,
    Francis

  • OLE Word Documentation

    Dear all,
    Where can i found a documentation about OLE using microsoft word ???
    Thanks.

    hi check this ..
    OLE
    http://www.sapgenie.com/abap/ole.htm
    http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm
    this is for word
    REPORT YTEST .
    *--Include for OLE-enabling definitions
    INCLUDE OLE2INCL .
    *--Global variables
    *--Variables to hold OLE object and entity handles
    DATA GS_WORD TYPE OLE2_OBJECT . "OLE object handle
    DATA GS_DOCUMENTS TYPE OLE2_OBJECT . "Documents
    DATA GS_ACTDOC TYPE OLE2_OBJECT . "Active document
    DATA GS_APPLICATION TYPE OLE2_OBJECT . "Application
    DATA GS_OPTIONS TYPE OLE2_OBJECT . "Application options
    DATA GS_ACTWIN TYPE OLE2_OBJECT . "Active window
    DATA GS_ACTPAN TYPE OLE2_OBJECT . "Active pane
    DATA GS_VIEW TYPE OLE2_OBJECT . "View
    DATA GS_SELECTION TYPE OLE2_OBJECT . "Selection
    DATA GS_FONT TYPE OLE2_OBJECT . "Font
    DATA GS_PARFORMAT TYPE OLE2_OBJECT . "Paragraph format
    DATA GS_TABLES TYPE OLE2_OBJECT . "Tables
    DATA GS_RANGE TYPE OLE2_OBJECT . "Range handle for various ranges
    DATA GS_TABLE TYPE OLE2_OBJECT . "One table
    DATA GS_TABLE_BORDER TYPE OLE2_OBJECT . "Table border
    DATA GS_CELL TYPE OLE2_OBJECT . "One cell of a table
    DATA GS_PARAGRAPH TYPE OLE2_OBJECT . "Paragraph
    DATA GV_POS(5) TYPE N . "Position information for table
    CREATE OBJECT GS_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 GS_WORD 'Visible' = '1' .
    *--Opening a new document
    GET PROPERTY OF GS_WORD 'Documents' = GS_DOCUMENTS .
    CALL METHOD OF GS_DOCUMENTS 'Add' .
    *--Getting active document handle
    GET PROPERTY OF GS_WORD 'ActiveDocument' = GS_ACTDOC .
    *--Getting applications handle
    GET PROPERTY OF GS_ACTDOC 'Application' = GS_APPLICATION .
    *--Setting the measurement unit
    GET PROPERTY OF GS_APPLICATION 'Options' = GS_OPTIONS .
    SET PROPERTY OF GS_OPTIONS 'MeasurementUnit' = '1' . "CM
    *--Getting handle for the selection which is here the character at the
    *--cursor position
    GET PROPERTY OF GS_APPLICATION 'Selection' = GS_SELECTION .
    GET PROPERTY OF GS_SELECTION 'Font' = GS_FONT .
    GET PROPERTY OF GS_SELECTION 'ParagraphFormat' = GS_PARFORMAT .
    *--Setting font attributes
    SET PROPERTY OF GS_FONT 'Name' = 'Arial' .
    SET PROPERTY OF GS_FONT 'Size' = '10' .
    SET PROPERTY OF GS_FONT 'Bold' = '1' . "Not bold
    SET PROPERTY OF GS_FONT 'Italic' = '1' . "Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF GS_PARFORMAT 'Alignment' = '2' . "Right-justified
    CALL METHOD OF GS_SELECTION 'TypeText'
    EXPORTING
    #1 = 'This is an OLE example!'.
    *--Setting the view to the main document again
    SET PROPERTY OF GS_VIEW 'SeekView' = '0' . "Main document view
    *--Reseting font attributes for the title
    SET PROPERTY OF GS_FONT 'Name' = 'Times New Roman' .
    SET PROPERTY OF GS_FONT 'Size' = '16' .
    SET PROPERTY OF GS_FONT 'Bold' = '1' . "Bold
    SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF GS_PARFORMAT 'Alignment' = '1' . "Centered
    CALL METHOD OF GS_SELECTION 'TypeText'
    EXPORTING
    #1 = TEXT-000.
    *--Advancing cursor to the new line
    CALL METHOD OF GS_SELECTION 'TypeParagraph' .
    *--Getting entity handles for the entities on the way
    GET PROPERTY OF GS_ACTDOC 'Tables' = GS_TABLES .
    GET PROPERTY OF GS_SELECTION 'Range' = GS_RANGE .
    *--Adding a table with 3 rows and 2 columns
    CALL METHOD OF GS_TABLES 'Add' = GS_TABLE
    EXPORTING
    #1 = GS_RANGE " Handle for range entity
    #2 = '3' "Number of rows
    #3 = '2'. "Number of columns
    *--Setting border attribute for the table
    GET PROPERTY OF GS_TABLE 'Borders' = GS_TABLE_BORDER .
    SET PROPERTY OF GS_TABLE_BORDER 'Enable' = '1' . "With border
    *--Filling the table with dummy data
    *--Reseting font attributes for table content
    SET PROPERTY OF GS_FONT 'Name' = 'Garamond' .
    SET PROPERTY OF GS_FONT 'Size' = '11' .
    SET PROPERTY OF GS_FONT 'Bold' = '0' . "Not bold
    SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Getting cell coordinates
    CALL METHOD OF GS_TABLE 'Cell'
    EXPORTING
    #1 = '1' "first row
    #2 = '1'. "first column
    *--Getting the range handle to write the text
    GET PROPERTY OF GS_CELL 'Range' = GS_RANGE .
    *--Filling the cell
    SET PROPERTY OF GS_RANGE 'Text' = 'Venkatesh Appikonda' .
    *--Getting cell coordinates
    CALL METHOD OF GS_TABLE 'Cell' = GS_CELL
    EXPORTING
    #1 = '3' "third row
    #2 = '2'. "second column
    *--Getting the range handle to write the text
    GET PROPERTY OF GS_CELL 'Range' = GS_RANGE .
    *--Filling the cell
    SET PROPERTY OF GS_RANGE 'Text' = 'this is ole example' .
    *--Advancing the cursor to the end of the table
    GET PROPERTY OF GS_TABLE 'Range' = GS_RANGE .
    GET PROPERTY OF GS_RANGE 'End' = GV_POS .
    SET PROPERTY OF GS_RANGE 'Start' = GV_POS .
    CALL METHOD OF GS_RANGE 'Select' .
    *--Skip some lines
    DO 10 TIMES .
    CALL METHOD OF GS_SELECTION 'TypeParagraph' .
    ENDDO.
    *--Reseting font attributes for ordinary text
    SET PROPERTY OF GS_FONT 'Name' = 'Times New Roman' .
    SET PROPERTY OF GS_FONT 'Size' = '12' .
    SET PROPERTY OF GS_FONT 'Bold' = '0' . "Not bold
    SET PROPERTY OF GS_FONT 'Italic' = '0' . "Not Italic
    SET PROPERTY OF GS_FONT 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF GS_PARFORMAT 'Alignment' = '3' . "Justified
    *--Indent the paragraph once
    GET PROPERTY OF GS_SELECTION 'Paragraphs' = GS_PARAGRAPH .
    CALL METHOD OF GS_PARAGRAPH 'Indent' .
    CALL METHOD OF GS_SELECTION 'TypeText'
    EXPORTING
    #1 = TEXT-002.
    FREE OBJECT GS_WORD .
    this is for excel..
    Report ZMULTICOLOR_TEST no standard page heading.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    include ole2incl.
    handles for OLE objects
    data: h_excel type ole2_object,        " Excel object
          h_mapl type ole2_object,         " list of workbooks
          h_map type ole2_object,          " workbook
          h_zl type ole2_object,           " cell
          h_f type ole2_object,            " font
          h_c type ole2_object.            " color
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    tables: spfli.
    data  h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *&   Event START-OF-SELECTION
    start-of-selection.
    read flights
      select * from spfli into table it_spfli.
    display header
      uline (61).
      write: /     sy-vline no-gap,
              (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
              (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
              (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
              (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
              (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
      uline /(61).
    display flights
      loop at it_spfli.
        write: / sy-vline no-gap,
                 it_spfli-carrid color col_key no-gap, sy-vline no-gap,
                 it_spfli-connid color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
                 it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
      endloop.
      uline /(61).
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-007
           exceptions
                others     = 1.
    start Excel
      create object h_excel 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      set property of h_excel  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'  .
    PERFORM ERR_HDL.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-008
           exceptions
                others     = 1.
    get list of workbooks, initially empty
      call method of h_excel 'Workbooks' = h_mapl.
      perform err_hdl.
    add a new workbook
      call method of h_mapl 'Add' = h_map.
      perform err_hdl.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-009
           exceptions
                others     = 1.
    output column headings to active Excel sheet
      perform fill_cell using 1 1 1 200 'Carrier id'(001).
      perform fill_cell using 1 2 1 200 'Connection id'(002).
      perform fill_cell using 1 3 1 200 'City from'(003).
      perform fill_cell using 1 4 1 200 'City to'(004).
      perform fill_cell using 1 5 1 200 'Dep. Time'(005).
      loop at it_spfli.
    copy flights to active EXCEL sheet
        h = sy-tabix + 1.
        if it_spfli-carrid cs 'AA'.
          perform fill_cell using h 1 0 000255000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'AZ'.
          perform fill_cell using h 1 0 168000000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'JL'.
          perform fill_cell using h 1 0 168168000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'LH'.
          perform fill_cell using h 1 0 111111111 it_spfli-carrid.
        elseif it_spfli-carrid cs 'SQ'.
          perform fill_cell using h 1 0 100100100 it_spfli-carrid.
        else.
          perform fill_cell using h 1 0 000145000 it_spfli-carrid.
        endif.
        if it_spfli-connid lt 400.
          perform fill_cell using h 2 0 255000255 it_spfli-connid.
        elseif it_spfli-connid lt 800.
          perform fill_cell using h 2 0 077099088 it_spfli-connid.
        else.
          perform fill_cell using h 2 0 246156138 it_spfli-connid.
        endif.
        if it_spfli-cityfrom cp 'S*'.
          perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
        elseif it_spfli-cityfrom cp 'N*'.
          perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
        else.
          perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
        endif.
        if it_spfli-cityto cp 'S*'.
          perform fill_cell using h 4 0 200200200 it_spfli-cityto.
        elseif it_spfli-cityto cp 'N*'.
          perform fill_cell using h 4 0 000111222 it_spfli-cityto.
        else.
          perform fill_cell using h 4 0 130230230 it_spfli-cityto.
        endif.
        if it_spfli-deptime lt '020000'.
          perform fill_cell using h 5 0 145145145 it_spfli-deptime.
        elseif it_spfli-deptime lt '120000' .
          perform fill_cell using h 5 0 015215205 it_spfli-deptime.
        elseif it_spfli-deptime lt '180000' .
          perform fill_cell using h 5 0 000215205 it_spfli-deptime.
        else.
          perform fill_cell using h 5 0 115115105 it_spfli-deptime.
        endif.
      endloop.
    EXCEL FILENAME
      CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
                  SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
      CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
      free object h_excel.
      perform err_hdl.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    form fill_cell using i j bold col val.
      call method of h_excel 'Cells' = h_zl
        exporting
          #1 = i
          #2 = j.
      perform err_hdl.
      set property of h_zl 'Value' = val .
      perform err_hdl.
      get property of h_zl 'Font' = h_f.
      perform err_hdl.
      set property of h_f 'Bold' = bold .
      perform err_hdl.
      set property of h_f 'Color' = col.
      perform err_hdl.
    endform.                    "FILL_CELL
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    form err_hdl.
      if sy-subrc <> 0.
        write: / 'OLE-Automation Error:'(010), sy-subrc.
        stop.
      endif.
    endform.                    " ERR_HDL
    regards,
    venkat

  • Insert OLE Word doc not showing all pages

    Hi All,
    I'm running a test on this before I get all involved in it.
    I insert a multi page Word doc into my report.
    When I run it, it only shows the first page.
    That's the first problem.
    When I export it as a Word doc, it exports only that page
    and now it's become a non editable graphic. 
    I need it to be exportable to Word and editable.
    That's the second problem.
    Am I attempting the impossible ?
    Thank you,
    Jimmy

    Hi Jamie,
    Thanks for your reply.
    We have a Word document that gets sent out to about 400 schools.
    I'm trying to take some of the redundancy out of the task by inserting
    Institution Name
    Director
    Address
    etc on the header of the document so that my colleges
    won't have to look up each school, find the director, address,
    etc and manually type it all in.  Then the report gets exported
    to Word, where further editing is done.
    Also, the tables that they have built in Word must also
    retain their integrity, being imported into AND being exported
    from Crystal, as a Word document.
    I could do this easily, and have, using text boxes, etc.  Problem
    is, it has to be done in Word. (That's what they're use to working with 
    Oh, my set up is:
    Crystal 11.5
    Stand alone desktop, no network.  (Just me and the lone prairie ...)
    Am I expecting too much ?
    Thanks for the 3rd party info.  That explains a lot.
    Jimmy

  • Report with OLE Object Problem (Crystal Report 11)

    Post Author: ibertola
    CA Forum: General
    Hi all,I'm a new user, and I've got a problem with OLE object. I would like to have a report that show me ONLY one of many OLE (word document) in Crystal structure.I've created 3 section detail, and in each one I've insert OLE object (creating from a file, and LINK).So, if I change one document stored locally, and then refresh the report, the content doesn't change like the linked file! Actually I've got all locally  Please help me.

    CR XI r2 is not supported on WIN 2008. See the [supported platforms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7081b21c-911e-2b10-678e-fe062159b453]
    documentation  and [this|https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567] wiki.
    Ludek

  • Word Documents and Forms 6

    Hi.
    I have spent the past three weeks reading forums and doco's from
    anywhere and everywhere on the web, and am battling to come up
    with a proper solution to my problem.
    I am currently storing office documents in a BLOB field in an 8i
    database. I use an OLE container bound to the BLOB field in the
    database to insert these documents from the client into the
    database using a forms 6 form, and this seems to be fine. Where
    the problem comes in is being able to retrieve these documents
    from the database and display them as an icon on a form so that
    users of my system will be able to edit and download these
    documents which are stored in the database. I want to allow them
    to click on the icon (which is a link to the document in the
    database) which will then launch the appropriate office product
    and allow them to do whatever they have to from there.
    Are there any suggestions as to how I can acheive this? I am
    really stumped here, and any help here would be greatly
    appreciated.
    Thanks.
    Craig.

    Is there proper ole documentation oracle provides for such types
    of problems , we are also suffering from the same(OLE & WORD
    INTEGRATION) problem and are not getting the proper soln.
    Calling oracle support for help as many peoples are suffering
    with the same problem
    ...Waiting ...

  • Change bookmark/text in footer (OLE-integration)

    Hi folks
    I have a ABAP program with OLE integration to Word (Old program, and therefore the old way to integrate - not DOI!) So far so good. It has been working for the last 4 years. Now I want to add some extra code, so I can insert a value to a bookmark in the footer. Alternative is to change a word in the footer. I have been fighting with the code for a quite a long time.
    My problem is to convert the shown macro to ABAP Method/Property coding!!
    The cursor is placed in the top of the document. In the footer I have a text: &Z_FOOT2&. This text I want to change with anoter value. No problem when I just activates the function Change All (recorded in the macro) - but how to do in ABAP???
    Hope You can help me!!
    REPORT ztces_word_test
           NO STANDARD PAGE HEADING
           LINE-SIZE 255
           MESSAGE-ID zcrm00.
    * OLE - Word Integration
    INCLUDE ole2incl.
    DATA o_word             TYPE ole2_object.
    DATA o_docs             TYPE ole2_object.
    DATA o_doc              TYPE ole2_object.
    DATA o_selection        TYPE ole2_object.
    DATA o_range            TYPE ole2_object.
    DATA: o_find            TYPE ole2_object.
    DATA skabelon(255)    TYPE c.
    CONSTANTS: tab(2) TYPE x VALUE '0D0A',
               wdtoggle TYPE i VALUE 9999998,
               c_true  TYPE i VALUE -1,
               c_false TYPE i VALUE 0.
    CONSTANTS: true VALUE 1, false VALUE 0.
    CONSTANTS:
       c_wdstory     TYPE i VALUE 6,
       c_wdextend    TYPE i VALUE 1.
    skabelon = 'C:SAPWORKDIRCRM Kundeplanfooter_change.dot'.
    CREATE OBJECT o_word 'Word.Application'.
    SET PROPERTY OF o_word 'Visible' = '1'.
    CALL METHOD OF o_word 'Documents' = o_docs.
    CALL METHOD OF o_docs 'Add' = o_doc
      EXPORTING
      #1 = skabelon.
    IF o_doc IS INITIAL.
      CALL METHOD OF o_word 'Quit'
        EXPORTING
        #1 = 0
        #2 = 1
        #3 = -1.
      COMMIT WORK.
      MESSAGE e001(ztces00) WITH skabelon 'IIE'
             RAISING skabelon_findes_ikke.
      FREE OBJECT o_doc.
      FREE OBJECT o_docs.
      FREE OBJECT o_word.
    ENDIF.
    CALL METHOD OF o_word 'Selection' = o_selection.
    * Here I have the MACRO which I recorded in the Word Document
    *    Selection.Find.ClearFormatting
    *    Selection.Find.Replacement.ClearFormatting
    *    With Selection.Find
    *        .Text = "&Z_FOOT2&"
    *        .Replacement.Text = "New footer text"
    *        .Forward = True
    *        .Wrap = wdFindContinue
    *        .Format = False
    *        .MatchCase = False
    *        .MatchWholeWord = False
    *        .MatchWildcards = False
    *        .MatchSoundsLike = False
    *        .MatchAllWordForms = False
    *    End With
    *    Selection.Find.Execute Replace:=wdReplaceAll
    *GET PROPERTY OF o_selection 'Find' = o_find.
    CALL METHOD OF o_selection 'Find' = o_find
      EXPORTING
      #01 = 'Z_FOOT2'.
    * Selection.FIND.ClearFormatting
    * Selection.FIND.Replacement.ClearFormatting
    *GET PROPERTY OF o_selection 'Find' = o_find.
    *CALL METHOD OF o_selection 'Find' = o_find.
    *CALL METHOD OF o_find 'Replacement' = o_find.
    *CALL METHOD OF o_find 'ClearFormatting' = o_find.
    CALL METHOD OF o_find 'Execute'
    *CALL METHOD OF o_selection 'Execute'
      EXPORTING
      #01 = '&Z_FOOT2&'
      #02 = true
      #03 = true
      #04 = false
      #05 = false
      #06 = false
      #07 = false
      #08 = false
      #09 = false
      #10 = 'New footer text'.
    CALL METHOD OF o_selection 'HomeKey' = o_range
      EXPORTING
      #1 = c_wdstory.
    FREE OBJECT o_word.
    Best regards
    Carsten :o)

    Hi,
    Go to Tocde: So10
    Give  as follows:
    Text Name       :ZXX_ZXXXXX_FOOTER
    Text ID              ST
    Language             EN
    and enter change mode, change whatever modifications you want.
    after run Standard program: RSTXTRAN  for adding Standradt text to transport request
    Regards
    Jana

  • Ole2 word.basic inserts at bookmarks

    Has anyone been able to insert at a bookmark in word?
    I copied code from http://technet.oracle.com/products/developer/pdf/oleword.pdf
    but it always inserts at the top of the file and not at the predefined bookmark
    anu ideas?
    Mick

    I make a template document (word document) with bookmark. I open the file. using ole word (from developer form) 'go to bookmark', then insert text. Look for word basic from WinWord ver. 6.
    Handojo Goenadi
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mick ([email protected]):
    Has anyone been able to insert at a bookmark in word?
    I copied code from http://technet.oracle.com/products/developer/pdf/oleword.pdf
    but it always inserts at the top of the file and not at the predefined bookmark
    anu ideas?
    Mick<HR></BLOCKQUOTE>
    null

Maybe you are looking for