3 Replies Latest reply: Jul 26, 2010 12:26 PM by Lucas Blancher RSS

    Export QVW layout Via Macro

    Lucas Blancher

      Hi Everyone,

      Does any one know how to export a document layout via marco or external code. I would like to create an automated system for extracting script and layout from a QVW, either via scheduled task or document reload. Extracting the script via macro seams easy enough, and I have found another post on how to do it, but I don't see anything on how to do the same for the layout. Anyone have any idea on how I might accomplish this?



      Lucas Blancher

      BizXcel Inc.

        • Export QVW layout Via Macro
          Fernando Toledo

          I don´t know if it is working on version 9, but you can export the layout configuration to a XML file.

          Try to find something in the APIGuide.qvd (in documentation folder inside QlikView Directory).

            • Export QVW layout Via Macro

              I am currently doing this. Here is an example of the code that I am using. This code will take a group of QVWs, export the document layout, and then create blank QVWs with the layout file. These have been really good for speeding up reloads.

              Dim Qv, Doc

              'On error Resume Next

              'Create an instance of QlikView and open a qv document

              FolderPath = "<Folder_Path>"
              Set objFSO = CreateObject("Scripting.FileSystemObject")
              Set objFolder = objFSO.GetFolder(FolderPath)
              set colSubFolders = objFolder.SubFolders

              for each fld in colSubFolders
              Set objFSO = CreateObject("Scripting.FileSystemObject")
              Set objFolder1 = objFSO.GetFolder(fld)
              set colFiles = objFolder.Files

              set Qv = CreateObject("QlikTech.QlikView")

              for each doc in colFiles
              Set SourceDoc = Qv.OpenDoc (doc,"","")
              SourceDoc.ExportLayoutFile fld & "\Source\" & doc.Name & ".Layout.xml"
              Set BlankDoc = Qv.CreateDoc
              BlankDoc.ImportLayoutFile fld & "\Source\" & doc.Name & ".Layout.xml"
              BlankDoc.SaveAs fld & "\Source\" & doc.Name