Uniface User Forum

 View Only
  • 1.  Uniface COM Interface to MS Word

    Posted 09-09-2021 17:04

    Hi Unifacers,

    I had already implemented interfaces from Uniface to Excel and Outlook, now it is time for Word. I've collected all Word COM signatures using /pid option of /sti command.

    I am currently able to open a Word document into DOCX format and apply to it various other operations/methods collected from automatic signatures loading. So far so good!

    Trying to save the document into an RTF format using SaveAs2 (SaveAs2 is the evolution of original SaveAs starting from MS Office 2010) I get this error:

    ICCDRV-COM-ERR Error with ICC system occurred, The call to COM method "SaveAs2" failed, due to a data type mismatch on COM parameter 0: COM error 0x80020005, described as "Incompatibilità tra tipi." (ICC system status: ←2147352571>).

    BTW: "Incompatibilità tra tipi" in italian means "data type incompatibility".

    What it seems very strange to me are these words "on COM parameter 0"; parameter 0 is usually the name of the call itself!

    I've already tried various actions, including:
    - verifying all parameters one by one and total number of them: parameters are all VT_VARIANT, aka string
    - defining all parameters explicitely (also if they are all defined as Optional into official documentation)
    - manually modifying SaveAs2 adding an handler at the beginning of it because on some documentation it is reported giving back an handler to the new object (not reusing the old handler)

    ...but the error is never changed so I am thinking something wrong happened during signatures loading but no trace about it in the original log from Uniface /sti.

    Could someone help me or at least point me in the right direction?

    Thanks in advance for any tips or trick!

    Regards,
    Gianni



  • 2.  RE: Uniface COM Interface to MS Word

    ROCKETEER
    Posted 09-10-2021 09:16

    Hi Gianni,

    VT_VARIANT means that it basically can be anything. But if a parameter is a numeric then it also needs to be defined like that in Uniface (i.e. set Uniface data type to Numeric and leave the COM data type VT_VARIANT).

    I guess the problem here is the FILEFORMAT parameter. You need to specify the format of the target file as a number. For RTF this should be 6 (see https://docs.microsoft.com/en-us/office/vba/api/word.wdsaveformat for details).

    And any parameter that is optional should be marked as such with a hyphen (-). Don't use an empty string or any other value, since this will (most likely) provoke more errors.

    Please note that there are two DOCUMENT signatures (if you don't use a prefix then it will be DOCUMENT and U_DOCUMENT). Make sure that you update both

    I hope this helps.

    Regards,
    Daniel



  • 3.  RE: Uniface COM Interface to MS Word

    Posted 09-15-2021 11:06

    Hi Daniel,

    thanks for your answer...just a small further question:

    you wrote " ... and leave the COM data type VT_VARIANT"

    When I change data type the default interface is applied (Boolean => VT_BOOL) for the new resulting data type; why you asked to leave VT_VARIANT, being it the interface to a generic object? which are differences in two cases?

    Regards,
    Gianni



  • 4.  RE: Uniface COM Interface to MS Word

    ROCKETEER
    Posted 09-16-2021 10:50

    This is just my preference. This allows me to identify VT_VARIANT parameters easily (even after changing the Uniface data type). At runtime it should not make a difference if (e.g.) a Boolean is defined as VT_BOOL or VT_VARIANT.



  • 5.  RE: Uniface COM Interface to MS Word

    Posted 09-13-2021 09:35

    Hi Gianni,

    when Uniface imports the Signature all "Data Type" is String.

    These are my settings for SAVEAS2:


    I hope this helps.


    Kind regards

    Norbert



  • 6.  RE: Uniface COM Interface to MS Word

    Posted 09-15-2021 11:07

    Hi Norbert,

    thanks a lot...it works!

    Best Regards,
    Gianni