Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
roger_stone
Creator III
Creator III

Changing document theme programatically

I don't think this can be done, but if anyone has a solution I'll be pleased to see it.

I would like to change the theme of a document programatically. I don't really care whether that would mean setting/checking a variable in the script or doing something just when the document loads, but I would like to be able to change the theme without having to do it manually.

Any ideas?

8 Replies
Not applicable

I found an example to change the Document Theme in the API Guide.

Here is the example:

ActiveDocument.ApplyTheme "A:\Forest.qvt"


That would need to be in a macro, which you could put in the OnLoad or OnActivate of the main sheet or something.

roger_stone
Creator III
Creator III
Author

Thanks Ninja, that works - though not quite as expected because of the bugs that exist in the theme wizard, but that's another story. The principle ok though - cheers.

Not applicable

Hi all,

It works at Document level but not at Sheet level, where this method is simply un-recognized by vbscript engine (v9 SR5 ) even if it's present in API.QVW documentation.

DOESN'T WORK

ActiveDocument.Sheets("QSH01").applyTheme "C:\Etr\Cruscotto.qvt"

WORK

ActiveDocument.applyTheme "C:\Etr\Cruscotto.qvt"



Any Idea?

Thanks in advance

Not applicable

Sorry, i forgot to mention that If I manually apply the theme at sheet level, it works perfectly, so it's not a matter of theme.

Thanks in advance,

Fabrizio

Not applicable

I'm also having trouble applying a theme to one sheet. I tried ActiveSheet() and GetSheetById() and neither did anything with ApplyTheme. I can set the theme for the entire document no problem. Maybe a bug?

EDIT: Just tried it in 10 with the same issue. I'd say this is a bug or at the very least ApplyTheme is not implemented for the Sheet object.

Not applicable

Hi NMiller,

I do agree with you , think it's a bug not a missing feature.

Hope QlikTech will fix it, it's not good when you extensively use themes and must force them manually.

The worst side is that themes do not dinamically update "themed" objects when you update the QVT file so this mess is a big, big deal.

Maybe,for tuture releases, an interesting new option could be "LINK TO A THEME" along by the actual "APPLY A THEME".

Thanks for your kind reply, this answered my post.

Not applicable


fabrizioyahoo wrote:
Hi all,
It works at Document level but not at Sheet level, where this method is simply un-recognized by vbscript engine (v9 SR5 ) even if it's present in API.QVW documentation.

DOESN'T WORK
ActiveDocument.Sheets("QSH01").applyTheme "C:\Etr\Cruscotto.qvt"
WORK
ActiveDocument.applyTheme "C:\Etr\Cruscotto.qvt"
Any Idea?
Thanks in advance
<div></div>


Thanks for pointing out this bug. It will be fixed in QV10 SR2.

Not applicable

I say thank you ... You and all the community members are Wellcome!

Happy Qliking,

Fabrizio.