Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lblancher
Partner - Contributor III
Partner - Contributor III

Export QVW layout Via Macro

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?

Thanks,

Lucas Blancher

BizXcel Inc.

1 Solution

Accepted Solutions
Not applicable

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"
SourceDoc.CloseDoc
Set BlankDoc = Qv.CreateDoc
BlankDoc.ImportLayoutFile fld & "\Source\" & doc.Name & ".Layout.xml"
BlankDoc.SaveAs fld & "\Source\" & doc.Name
BlankDoc.CloseDoc
next
Next

QV.Quit

View solution in original post

3 Replies
fernandotoledo
Partner - Specialist
Partner - Specialist

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).

Not applicable

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"
SourceDoc.CloseDoc
Set BlankDoc = Qv.CreateDoc
BlankDoc.ImportLayoutFile fld & "\Source\" & doc.Name & ".Layout.xml"
BlankDoc.SaveAs fld & "\Source\" & doc.Name
BlankDoc.CloseDoc
next
Next

QV.Quit

lblancher
Partner - Contributor III
Partner - Contributor III
Author

Wow, that was exactly what I was looking for! Thank you very much!

Lucas Blancher

BizXcel Inc