Forum Stats

  • 3,839,950 Users
  • 2,262,552 Discussions
  • 7,901,101 Comments

Discussions

Webutil OLE2 in Forms 12

Alexis B
Alexis B Member Posts: 45 Red Ribbon
edited Aug 27, 2020 11:13AM in Forms

Hi All

I am migrating an oracle forms 6i application to a forms 12.1.2.4 application

In forms 6i, I have the screen that generate an xml file

pastedImage_0.png

and display it in an OLE Object (Excel.Sheet.8) in a forms 6i screen

pastedImage_1.png

Is it possible to display an xml file with the same way in Forms 12c? Else I will open directly the XML file with Web.Show_Document, not a big problem i know do this.

BUT before this I have the problem to generate the XML file

In forms 6i Library OLE2 was used. I tried to replace OLE2 library with CLIENT_OLE2 package from library WEBUTIL

But when I execute it I got the following error message :

When trying to execute the following line :

application := CLIENT_OLE2.create_obj('Excel.Application');

I know that my Webutil is correctly configure as I can use the following webutil function withouth any error :

WEBUTIL_FILE.FILE_OPEN_DIALOG

Any Idea why this error occurs?

On my PC I have Microsoft Office Professionnel Plus 2016 installed

On the Application server Excel is not installed. Could it be the cause?

Thanks,

Best regards,

Tagged:

Best Answer

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 27, 2020 3:47AM Answer ✓

    Hi,

    Thanks for your help but problem was not on webutil configuration.

    As explained I already set Webutil with in others screen WEBUTIL_FILE.FILE_OPEN_DIALOG and it works well.

    I found the solution on http://www.orafaq.com/forum/t/138991/2/

    My function was automatically launched in when new-form-instance.

    But as explained in the article, Webutil cannot be launched in triggers : PRE-FORM, WHEN-NEW-FORM-INSTANCE and WHEN-NEW-BLOCK-INSTANCE for the first block in the Form

    However, there is an important restriction in the use of WebUtil functions: WebUtil can only start to communicate with the client once the Form has instantiated the WebUtil PJCs.

    This means that you cannot call WebUtil functions before the Forms user interface is rendered.

    So, I copied the code of WHEN-NEW-FORM-INSTANCE into WHEN-TIMER-EXPIRED trigger and use the following code in WHEN-NEW-FORM-INSTANCE

    declare

    fake_timer TIMER;

    begin

    --

    -- Purpose of the fake timer is the we cannot call webutil in this trigger since the

    -- beans have not yet been instantiated. If we put the code in a when-timer-expired-trigger

    -- it means that this timer will not start running until Forms has focus (and so the webutil

    -- beans will be instantiated and so call canbe made.

    --

    fake_timer:= CREATE_TIMER('webutil',100,NO_REPEAT);

    --create_blob_table;

    null;

    end;

    So now I do not have the error but all is not working well, I don't have error but my file is not generated.

    Will take a look and let you know.

    Best regards,

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,330 Employee
    edited Aug 26, 2020 10:01AM

    Any old Forms applications that previously used ActiveX control objects or OLE objects must first remove these objects from the form before upgrading.  These object types are not supported in web deployed Forms applications.  This is explained in the document titled "Upgrading Oracle Forms 6i Applications" found here:

    https://docs.oracle.com/en/middleware/developer-tools/forms/12.2.1.4/index.html

    I encourage you to review this document before proceeding.

    Regarding the creation of an Excel sheet on the user's machine with WebUtil, take a look at MyOracleSupport Note 270986.1 The note includes example code illustrating one possible way to accomplish what you are requesting.

    Also, you mentioned an "error" but never shared the details of the error.


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 26, 2020 10:14AM

    Yes I know tat OLE object are not supported in Forms Web applications, It is why i wrote that if it is not possible to display them it is not a problem as I know I can launch XML file with web.show_document

    I just wonder be sure it was not possible.

    Regarding the error, I forgot to add the screenshot, Sorry

    pastedImage_0.png

    So now I will take a look at the note 270986.1 you passed to me

    Thanks,

    Best regards,

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 26, 2020 10:17AM

    And sorry I just saw I mastyped above, it is not an XML file I want to write but an XLS file (with graphics)

    But not sure it will be different

    Best regards,

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,330 Employee
    edited Aug 26, 2020 11:46AM

    The error you shared can be caused by anyone or more of the following:

    1.  You ran the form with a configuration that is not WebUtil enabled.  The installation provides example configurations that you can use to test.  For example: [webutil] or [webutil_webstart]

    http://example.com/forms/frmservlet?form=myForm&config=webutil_webstart

    2.  You did not perform a compile_all=yes on the form before generating the FMX.  This can be done in the Builder from the menu or using Shift+Ctrl+k.  If doing this in the Builder, you should Save after executing then generate the FMX

    3.  You did not include the WebUtil object group from the WebUtil Object Library (webutil.olb) in your form.  Specifically you must include the group that includes OLE.

    pastedImage_1.png

    Although not related to the error, but understand that in order to perform OLE operations on the user's machine you will need to download and sign the Jacob libraries.  Refer to the documentation for setup details.  There is also a MyOracleSupport Note that explains this.


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 27, 2020 3:47AM Answer ✓

    Hi,

    Thanks for your help but problem was not on webutil configuration.

    As explained I already set Webutil with in others screen WEBUTIL_FILE.FILE_OPEN_DIALOG and it works well.

    I found the solution on http://www.orafaq.com/forum/t/138991/2/

    My function was automatically launched in when new-form-instance.

    But as explained in the article, Webutil cannot be launched in triggers : PRE-FORM, WHEN-NEW-FORM-INSTANCE and WHEN-NEW-BLOCK-INSTANCE for the first block in the Form

    However, there is an important restriction in the use of WebUtil functions: WebUtil can only start to communicate with the client once the Form has instantiated the WebUtil PJCs.

    This means that you cannot call WebUtil functions before the Forms user interface is rendered.

    So, I copied the code of WHEN-NEW-FORM-INSTANCE into WHEN-TIMER-EXPIRED trigger and use the following code in WHEN-NEW-FORM-INSTANCE

    declare

    fake_timer TIMER;

    begin

    --

    -- Purpose of the fake timer is the we cannot call webutil in this trigger since the

    -- beans have not yet been instantiated. If we put the code in a when-timer-expired-trigger

    -- it means that this timer will not start running until Forms has focus (and so the webutil

    -- beans will be instantiated and so call canbe made.

    --

    fake_timer:= CREATE_TIMER('webutil',100,NO_REPEAT);

    --create_blob_table;

    null;

    end;

    So now I do not have the error but all is not working well, I don't have error but my file is not generated.

    Will take a look and let you know.

    Best regards,

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 27, 2020 4:04AM

    Ok so, I says too fast :

    I didn't see a pop-up window :

    pastedImage_0.png

    So if I click on "Continuer", my file is created

    So now a new Question :

    Is there a way to not display this screen?

    I thought it is because it is a .XLS that is generated. Is there a way to generate an XLSX file easily maybe?

    FYI: I have Microsoft Office Professionnel Plus 2016 installed on my PC

    Thanks,

    Best regards,

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,330 Employee
    edited Aug 27, 2020 8:18AM

    The message you are getting is coming from Microsoft and not Forms.  It appears to be the result of the format used to create your spreadsheet.  Likely the only way to avoid this would be to create the sheet using the formatting of a newer Excel version.  If you are generating the sheet from the calls made from Oracle Forms, you likely need to modify your OLE code.  Remember that the code example provided in the MyOracleSupport Note is just an "example" and was written many years ago.  You would need to refer to the Microsoft OLE documentation in order to properly update your OLE code.

    For everyone else's benefit, I have attempted to translate the Microsoft message shared above:

    The following features of this workbook are not supported in earlier versions of Excel. These features may be lost or degraded if you save the workbook in an earlier file format. Click Continue to save the workbook anyway. To keep all functionality, click Cancel, and then save the file in one of the new formats.Significant loss of functionalityIn earlier versions of Excel, only row colors from the color palette are supported. When opening the workbook in an earlier version of Excel each row color is matched to the closest color on the color palette. A graph can thus display several series in the same color.Location: 'GRAPH_GEPLOG', Shapes


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • Alexis B
    Alexis B Member Posts: 45 Red Ribbon
    edited Aug 27, 2020 11:13AM

    Ok, I will take a look at the documentation but not a priority as xls file is correctly generated

    Thanks for your help

    Best regards,