Udostępnij za pośrednictwem


Identifying wizard shapes in a publication

I recently finished an article on how to generate publications based on pre-designed wizards in Publisher:

https://msdn.microsoft.com/office/understanding/publisher/articles/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/odc_pb_createwizardpubs.asp

Here’s something I didn’t cover in the article, because it was a little more advanced than the basic overview-type article I was writing.

But not only do publications and pages have wizard properties, but shapes do as well. Any shape that Publisher adds to the default appearance of a publication based on a wizard design has two properties that uniquely identify it. Publisher uses these properties to keep track of shapes that ‘belong’ to the wizard design, as opposed to any custom shapes the user might add to the publication later. If the user selects a different wizard design for the publication, Publisher ‘morphs’ the publication by changing the wizard shapes (adding, deleting, and changing shape properties) to the default appearance of the selected wizard design. Any shapes the user has added to the publication are left unchanged.

WizardTag and WizardTagInstance are the two shape properties; together, they comprise a unique identifier for each wizard shape in the publication. WizardTag refers to the type and style of shape (a textbox of a certain style, a photo of a certain type, etc), while WizardTagInstance is the instance of that shape type in the publication. Every shape, whether generated by a wizard or not, has a WizardTag and WizardTagInstance property. For non-wizard shapes (that is, shapes that the user inserted into the publication), the value of each property is 0.

There are several interesting aspects of wizard tags to keep in mind:

· The instance numbering is not always consecutive, but it is predictable. If you’ve got five instances of a certain shape type in your publication, don’t assume their WizardTagInstance values run from 1 to 5, because they probably don’t. From what I can tell, numbering appears to be consecutive within a given publication page, but not from page to page. For example, in the photo gallery wizard page, each page starts the first photo shape as a multiple of 64. Play with it before making any assumptions on how the instances are numbered.

· While the WizardTag and WizardTagInstance property values are assigned by Publisher, and used to get track of the shapes generated by the wizard design, the properties themselves are not read-only. You can get and set them at will. Also, Publisher does not validate to guarantee a given WizardTag-WizardTagInstance combination is assigned to only one shape per publication. So you can easily set several shapes to have the same wizard tag and instance combination. In fact, if you wanted to treat these shapes as a subset of the wizard tag type, you might want to do this on purpose.

· You can use the FindByWizardTag method (pass it a tag type and instance number) to return a specific instance, or even all instances of that tag. The method returns a ShapeRange collection. This is one of the few instances where you can create a Shapes collection that spans publication pages. For instance, if you wanted to apply formatting to all shapes of a certain wizard type (article textboxes in a newsletter, for instance), regardless of the page they appear on, this is how you’d do it.

· Changing a shape’s WizardTag property to 0 excludes it from being updated the next time you change wizard designs. The most that will happen is that the shape’s colors may change. This is because the SchemeColor property for each ColorFormat object in the shape is still set; when Publisher changes the color scheme based on the wizard design, each color in the shape updates to the new color specified for that scheme color (Main, Accent1, etc.).

Wizard properties for shapes should not be confused with group wizard shapes, which are a different beast altogether. I hope to write up a little something about group wizard shapes later in the week, as well as discuss the Tag property of Shapes. I should probably mention AutoShapes as well, just to make sure everyone’s totally confused.

Until then…

Comments

  • Anonymous
    May 09, 2005
    Publisher has a different concept of templates and wizards than other Office programs, such as Word. In Publisher, both terms refer to publication types on which you can base your publications, with important differences:
    Publication wizards are pre-defined publications that come bundled with Publisher. These publication wizards contain text boxes and other design elements that you can customize, and to which you can add your content, in the publications you create using them.
    Templates are us
  • Anonymous
    April 29, 2008
    PingBack from http://ezinefrontpageblog.info/andrew-mays-weblog-identifying-wizard-shapes-in-a-publication/
  • Anonymous
    June 15, 2009
    PingBack from http://unemploymentofficeresource.info/story.php?id=14662