Topic
1 reply Latest Post - ‏2014-02-27T08:55:31Z by Scaramouch
Molgy
Molgy
14 Posts
ACCEPTED ANSWER

Pinned topic Excel Sheet WaterMark

‏2013-12-05T15:29:27Z |

Hello Falk's,

I would like to implement a watermark after a Excel sheet was created by Doors OLE Interface. But, how?

Does anyone have an idea? Background picture?

STB

 

 

Updated on 2013-12-05T17:38:00Z at 2013-12-05T17:38:00Z by Molgy
  • Scaramouch
    Scaramouch
    3 Posts
    ACCEPTED ANSWER

    Re: Excel Sheet WaterMark

    ‏2014-02-27T08:55:31Z  in response to Molgy

    Hallo Falk's,

     

    I got a solution. But there is a tiny mistake included.

     

    string sFile = doorsHome "\\lib\\dxl\\... "


        // set water mark on display..
        clear( args )
        put( args, sFile )
        oleMethod( objSheet, "SetBackgroundPicture", args )

        // get page setup..
        oleGet( objSheet, cPropertyPageSetup, objPageSetup )
        oleGet( objPageSetup, "CenterHeaderPicture", objPicHeader )
        oleGet( objPageSetup, "CenterFooterPicture", objPicFooter )

        // set watermark to page headers.. available for printout
        olePut( objPicHeader, "Filename", sFile )
        olePut( objPicHeader, "Height", 780.75 )  // 624.75    780.75
        olePut( objPicHeader, "Width",  734.25 )  // 587.25    734.25

        // set watermark to page footer.. available for printout
        olePut( objPicFooter, "Filename", sFile )
        olePut( objPicFooter, "Height", 780.75 )  // 624.75    780.75
        olePut( objPicFooter, "Width",  734.25 )  // 587.25    734.25

    Please be so kind to test this. No error messages. But the PicFooter part will not work.

    If you will run the following excel macro, the watermark at the footer will be placed:

    Sub InsertPicture()
     
     With ActiveSheet.PageSetup.CentertFooterPicture
     .FileName = "C:\Sample.jpg"
     .Height = 275.25
     .Width = 463.5
     .Brightness = 0.36
     .ColorType = msoPictureGrayscale
     .Contrast = 0.39
     .CropBottom = -14.4
     .CropLeft = -28.8
     .CropRight = -14.4
     .CropTop = 21.6
     End With
     
     ' Enable the image to show up in the center footer.ActiveSheet.PageSetup.CenterFooter = "&G"
     
    End Sub

    Does anyone have an idea?

    STB

    Updated on 2014-02-27T09:02:49Z at 2014-02-27T09:02:49Z by Scaramouch