This post is a result of two separate questions/requests from customers. One customer was interested in applying conditions to the text in her source documents using styles and the other was wondering if there was a way to “color code” conditions like you can in other tools, such as Framemaker or RoboHelp.
Doc-To-Help has two pre-defined styles that control conditional text: C1H Online and C1H Manual. Anything you apply C1H Online to will only appear in online outputs (basically anything but a manual). Anything you apply a C1H Manual style to will only appear in Manual targets.
If you want to create a style that works for a specific platform, target, or attribute (you want one that’s NetHelp specific or Mobile specific, whatever the case may be), here’s what you do. I created a Word version of this project and an XML version of this project. Both projects are zipped and you can download them here. If you’re interested in setting up your projects with the same style names and settings that I did, all that is in there. You can copy everything from the templates (Word) or style sheets (XML) and the Doc-To-Help projects I created.
For Word documents:
- Go to the Source Template dropdown and choose Edit Template. Your template will open in Word.
- Create a new style (called C1H NetHelp) in the template and base it off of C1H Conditional. Then set the formatting in the style to the color of your choice.
- Copy the style to your Target Templates using the Organizer in Word (see UsingTheOrganizer.docx in the sample project).
- In Doc-To-Help, go to the Project tab and click the Project Styles button.

- In the Add New Style dropdown, select Character Style. A new style will be created and you can choose the name of the style from a dropdown, so choose C1H NetHelp and base it off the C1H Conditional style, not the style defaults.

- From there, you can modify the Platform, Target, and Attribute, just like you would in the Conditional Text dialog using the button in the Doc-To-Help toolbar. Any text you apply that style to in the Word document will follow those rules. I color coded my conditions so that Mobile is orange, NetHelp is pink, and HTML Help is green. I also added the styles to the Quick Style Gallery in Word.
The outputs will reflect the conditions you applied in the documents. Here’s what the Mobile output looks like in that sample (identifies the user as a Mobile User and instructs them to “Tap” instead of “Click” the Getting Started topic).
For XHTML documents in Doc-To-Help’s built-in editor:
The last three steps in Doc-To-Help are the same (creating the styles in Project Styles, modifying the Platform, Target, or Attribute). Creating and applying the styles are slightly different and don’t involve using the Organizer. Any style that you create from a document in the built-in editor is automatically copied to your Target style sheet, so the editor saves you that extra step.
- Double-click any .xml file in your project to open it up in the editor.
- In the Editor tab, click the Style List button.

- In the Style List, click the Add New Style button and create the Character styles (C1HNetHelp, C1HMobile, C1HHTMLHelp). Remember that you need to specify that the style is a Character style in the dropdown (Paragraph style is the default) and that styles created in the editor cannot have dashes or spaces.

- From there, highlight text and apply styles as you normally would. The styles I created also got added to the Quick Style Gallery in the Editor tab.
Try it out and let us know your results!






Development said that this is not functionality that is currently available in Doc-To-Help when you apply conditional styles. It is functionality that is missing in the software and is something that is now on the list to fix. However, it will not make it into the V3 release, since it takes time to change the architecture of the styles and their behavior.
In the meantime, you can use both conditional text styles and the conditional text button on the Doc-To-Help toolbar in your projects. It’s not an either-or situation. You can use both – styles for content and images and the conditional text button for tables. This is what you can use for a workaround until the functionality is available in the software entirely through styles.
Hope this helps!
Brad
Thanks, Frank! We’ll take a look and I’ll post back here with an update.
Brad, we’ve tried this out using our own Word source and it works pretty well, with one notable exception: tables. When I saw the unexpected behavior, I went back to your own project and doctored the Word source, with the same results. It’s easily reproducible. Here’s what you do. Add a table with (since you have three different character styles in the project) six rows. In the first and fourths rows put some unique text and apply the C1H Mobile style to the whole row(s). Do the same for the second and fifth rows, applying the C1H NetHelp style and again for the third and sixth rows, applying the C1H HTML Help style. Note that you have to include the end-of-row marker when you apply the style in each case. Now generate your output and check the resulting table. The marked rows are not eliminated, instead they are included as empty rows of zero height (note the thickened lines where the eliminated rows appear). Those thickened lines prompted me to look at the HTML source and, sure enough, there are six rows in the table but only two have (a) content and (b) dimensions. We’d really like to hear of a workaround for this because we like the color-coding technique MUCH BETTER than the use of conditional text that appears as comments, since (a) the color-coded character styles make it much easier to visually identify conditions and (b) we can search for the styles, something we cannot do if we use conditional text (unless I’m missing something).