3 Replies Latest reply: Feb 17, 2017 12:12 PM by Helmut Zörrer RSS

    how to dynamically change a (bundle loaded) Image as a Background of a PivotTable in QlikView

    Helmut Zörrer

      I want to have a (bundle loaded) Image as a background of a pivot-table. But this image must change one some selections.

      My_Images:

      BUNDLE LOAD

        Area

        ,Image

        FROM

      My_Pics.xlsx

      (ooxml, embedded labels, table is Tabelle1);


      (1) My first solution was to create a Text Object (TX01) set it to Image  - Fill - 
      and use =INFO(Area) (or qmem://<bundled>/xxx.jpg) in the Text Field.
      Then i placed this Text Object beneath my pivot (PI01) using appropriate transparency on the pivot.
      This worked fine but on another monitor AND in WebView the Pivot Table has a bug - it chages it size - it's getting bigger.
      (might be that row height - which i can't change in a property using pixel-settings leads to that behaviour)
      So the stupid Pivot Table doesn't remain stable above of my Text Object :-(


      (2) Because (1) failed i tryed to set the background Image of the Pivot per Visual Basic Script.
      I can set it in the Editor - but per script?
      On PivotTable (and some other charts) Background is not as simple to set as a 'Expression' in the TextBox.
      Some API-Samples i found don't work too...
      The code must be something like

        SET chartObject = ActiveDocument.GetSheetObject("PI01")

        SET oProps = chartObject.GetProperties  '-> IGraphProperties

        oProps.GraphLayout.Frame.Background.ImageBlob = ??? 
        ...
        chartObject.SetProperties oProps


      I tryed to copy the image of a Text Object using that script - but no luck.
      But i couldn't find any better hint.
      One thread mentioned todo something like this - but there's no XElement in QlikView - Edit Module - VBscript:
      ---

      XElement bmp = new XElement("Bmp");

      bmp.Add(new XAttribute("enctype", "base64"));

      bmp.Value = base64encodedFile;

      XElement root = new XElement("QVTheme", new XElement("TextObjectProperties"

        , new XElement("Layout", bmp)));

      string objFileName = Path.GetTempFileName();

      root.Save(objFileName);

      newObj.ApplyTheme(objFileName);

      File.Delete(objFileName);

      ---

       

      (btw: VbScript debugging in 'Edit Module' seems to be 'verry hard' + API-Docu is also 'not the best')

       

      So maybe there's another solution how to get it done that 2 controls remain stable above each other (Container??).
      Or set Positions + widh + height per script -

        SET pivtObject = ActiveDocument.GetSheetObject("PI01")

        SET tximgObject = ActiveDocument.GetSheetObject("TX01")

        pivtPos = pivtObject.GetRect

        tximgPos = tximgObject.GetRect

        tximgObject.SetRect pivtPos

      works - but on what event? - and that doesn't seem to work in webview at all...
      Or this qlikview bug that Pivot Table changes it's size in webview or on other monitors is fixed? (my version is 11.20. SR15)
      Would be happy for any hints