Selecting XHTML export templates at runtime

Two DataWindow properties, Export.XHTML.TemplateCount and Export.XHTML.Template[ ].Name, enable you to provide a list of templates from which the user of the application can select at runtime.

The TemplateCount property gets the number of templates associated with a DataWindow object. You can use this number as the upper limit in a FOR loop that populates a drop-down list with the template names. The FOR loop uses the Template[ ].Name property.

Dim count As String
Dim templateName As String
Dim i As Long

count=wdw.Describe
 ("DataWindow.Export.XHTML.TemplateCount")

for i=1 to CLng(count)
   templateName = wdw.Describe  _
      ("DataWindow.Export.XHTML.Template[" + Cstr(i) _
      + "].Name")
   DDL1.Items.Add(New ListItem(templateName))
next

Before generating the XHTML, set the export template using the value in the drop-down list box:

wdw.SetProperty  _
   ("DataWindow.Export.XHTML.UseTemplate", _
     DDL1.SelectedValue())