Integrating imported formatting globally

<< Click to Display Table of Contents >>

Navigation:  More Advanced Procedures > Replacing Formatting and Styles >

Integrating imported formatting globally

If you have the Premium Pack style pack add-on for Help+Manual 7 you can use its powerful Toolbox utility to convert formatting imported from HTML to styles. Provided the imported text used HTML classes, Toolbox can strip out the manual formatting and apply the style attributes to bring your imported text fully under the control of your project stylesheet.

About formatting in text imported from HTML

When you import HTML files or a CHM help file to a Help+Manual project your formatting comes in as inline formatting. Normally, you need to create styles based on the formatting and then manually apply them to all the paragraphs in your project where you want to use the style. This new tool eliminates many hours of tedious work by doing this automatically.

If your imported text includes style names you can use Normalize Project Styles in the Tools menu of Toolbox to remove the inline formatting and apply the style to all paragraphs in the project using the style. All you need is for a paragraph or any text within the paragraph to be tagged with a style name. It will then apply your selected paragraph style to the entire paragraph, eliminating manual formatting at the same time.

Click to expand/collapseWhy is this better than just re-applying styles or using the Replace Styles tool in Help+Manual?

This is fully compatible with Tidy XML

The Normalize Project Styles function is fully compatible with the new Tidy XML function introduced in Help+Manual 7.3. It automatically identifies whether topics are formatted with the Tidy XML option active or not and adjusts its own XML formatting accordingly.

For the most compact code it is best to use both Tidy XML and normalizing.

The imported text does need to include style names

After importing HTML files or a CHM file, first check whether the text is tagged with style names – it will be if style names (classes or IDs) were used in the original HTML. All you need to identify a paragraph for normalization is for some text anywhere within the paragraph to be tagged with a style name.

This is necessary, because otherwise it's not possible to identify the paragraphs you want to re-style. Style names that are not present in the stylesheet are shown in red in the style selector. If you are using Help+Manual 7.2 or earlier you may need to activate the XML editor briefly to make the red style names appear in the current topic (this cosmetic bug is fixed in version 7.3 and later).

imported_style

Step 1: Create the paragraph style you want to use for all the text containing the imported style

The easiest way to do this is to use a paragraph already containing the style name as a model. Make any adjustments to the formatting you want in the Help+Manual editor, then click in the text that is formatted the way way want it and select Styles > Create Style from Selection in the Write tab.

style_from_selection

Repeat this for all the styles you want to use. Then save the project when you have finished and close it.

Step 2: Normalize the styles with Toolbox

Open the project with PP Toolbox and select the Normalize Project Styles option in the Tools menu. Then select the Individual Styles tab.

normalize_styles

If you have used the name of the imported style for the style added to your project stylesheet you just need to select its name in the Style to normalize: field and it will be used both for identifying the paragraphs to style and for normalizing. Otherwise you need to select the style to be applied to the identified paragraphs with the Replace with paragraph style option.

Set the other options as explained in the screenshot above, then click on Normalize Style to proceed. The first time you do this you should then check the results in your project before proceeding with additional styles.