<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change Background Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Change-Background-Macro/m-p/747164#M661286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the ImageBlob property does not seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make this work by extracting the imagefile using the WriteXmlPropertiesFile property (Bmp node)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And setting it to the new object using the applytheme method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In c# :&lt;/P&gt;&lt;P&gt;XElement bmp = new XElement("Bmp");&lt;/P&gt;&lt;P&gt;bmp.Add(new XAttribute("enctype", "base64"));&lt;/P&gt;&lt;P&gt;bmp.Value = base64encodedFile;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XElement root = new XElement("QVTheme", new XElement("TextObjectProperties", new XElement("Layout", bmp)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;string objFileName = Path.GetTempFileName();&lt;/P&gt;&lt;P&gt;root.Save(objFileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newObj.ApplyTheme(objFileName);&lt;/P&gt;&lt;P&gt;File.Delete(objFileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's the only solution that I have found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oh and don't forget to set the UserSized property to true BEFORE applying the theme or else the object will resize to the image original size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Loic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 Apr 2015 23:00:07 GMT</pubDate>
    <dc:creator>lft</dc:creator>
    <dc:date>2015-04-19T23:00:07Z</dc:date>
    <item>
      <title>Change Background Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Change-Background-Macro/m-p/747163#M661284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to make a macro to change background image of TextObject from another TextObject.&lt;/P&gt;&lt;P&gt;I use example from APIGuide 11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;'Set the background image of an object from another&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;set mybox1 = ActiveDocument.GetSheetObject("LB01")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;dim MyBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp1 = mybox1.GetProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;MyBlob = mbp1.Layout.Frame.Background.ImageBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;set mybox2 = ActiveDocument.GetSheetObject("LB02")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp2 = mybox2.GetProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp2.Layout.Frame.Background.UseImage=true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp2.Layout.Frame.Background.UseColor=false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp2.Layout.Frame.Background.ImageBlob = MyBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;mybox2.SetProperties mbp2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I change Just "LB01" to "TX01" and "LB02" to "TX02" and code not work. But with ListBox code work perfectly.&lt;/P&gt;&lt;P&gt;Also i trying this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;'Set the background image of an object from another&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;set mybox1 = ActiveDocument.GetSheetObject("TX01")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;dim MyBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp1 = mybox1.GetProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp1 = mybox1.GetFrameDef&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;MyBlob = &lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp1&lt;/SPAN&gt;.Background.ImageBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;set mybox2 = ActiveDocument.GetSheetObject("TX02")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;mbp2 = mybox2.GetProperties&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp2 = mybox2.GetFrameDef&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp2&lt;/SPAN&gt;.Background.UseImage=true&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp2&lt;/SPAN&gt;.Background.UseColor=false&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;fbp2&lt;/SPAN&gt;.Background.ImageBlob = MyBlob&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;mybox2.SetFrameDef fbp2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333330154419px;"&gt;mybox2.SetProperties mbp2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #575757; font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #575757; font-size: 13.3333330154419px;"&gt;No effect. Also, same situation with Button.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #575757; font-size: 13.3333330154419px;"&gt;Anyone help?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2015 05:36:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-Background-Macro/m-p/747163#M661284</guid>
      <dc:creator />
      <dc:date>2015-03-19T05:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change Background Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Change-Background-Macro/m-p/747164#M661286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the ImageBlob property does not seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make this work by extracting the imagefile using the WriteXmlPropertiesFile property (Bmp node)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And setting it to the new object using the applytheme method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In c# :&lt;/P&gt;&lt;P&gt;XElement bmp = new XElement("Bmp");&lt;/P&gt;&lt;P&gt;bmp.Add(new XAttribute("enctype", "base64"));&lt;/P&gt;&lt;P&gt;bmp.Value = base64encodedFile;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XElement root = new XElement("QVTheme", new XElement("TextObjectProperties", new XElement("Layout", bmp)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;string objFileName = Path.GetTempFileName();&lt;/P&gt;&lt;P&gt;root.Save(objFileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newObj.ApplyTheme(objFileName);&lt;/P&gt;&lt;P&gt;File.Delete(objFileName);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's the only solution that I have found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oh and don't forget to set the UserSized property to true BEFORE applying the theme or else the object will resize to the image original size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Loic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 23:00:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-Background-Macro/m-p/747164#M661286</guid>
      <dc:creator>lft</dc:creator>
      <dc:date>2015-04-19T23:00:07Z</dc:date>
    </item>
  </channel>
</rss>

