## HtmlSaveOptions.CssClassNamePrefix property

Specifies a prefix which is added to all CSS class names. Default value is an empty string and generated CSS class names have no common prefix.

```csharp
public string CssClassNamePrefix { get; set; }
```

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentException | The value is not empty and is not a valid CSS identifier. |

## Remarks

If this value is not empty, all CSS classes generated by Aspose.Words will start with the specified prefix. This might be useful, for example, if you add custom CSS to generated documents and want to prevent class name conflicts.

If the value is not `null` or empty, it must be a valid CSS identifier.

## Examples

Shows how to save a document to HTML, and add a prefix to all of its CSS class names.

```csharp
Document doc = new Document(MyDir + "Paragraphs.docx");

HtmlSaveOptions saveOptions = new HtmlSaveOptions
{
    CssStyleSheetType = CssStyleSheetType.External,
    CssClassNamePrefix = "myprefix-"
};

doc.Save(ArtifactsDir + "HtmlSaveOptions.CssClassNamePrefix.html", saveOptions);

string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlSaveOptions.CssClassNamePrefix.html");

Assert.That(outDocContents.Contains("<p class=\"myprefix-Header\">"), Is.True);
Assert.That(outDocContents.Contains("<p class=\"myprefix-Footer\">"), Is.True);

outDocContents = File.ReadAllText(ArtifactsDir + "HtmlSaveOptions.CssClassNamePrefix.css");

Assert.That(outDocContents.Contains(".myprefix-Footer { margin-bottom:0pt; line-height:normal; font-family:Arial; font-size:11pt; -aw-style-name:footer }"), Is.True);
Assert.That(outDocContents.Contains(".myprefix-Header { margin-bottom:0pt; line-height:normal; font-family:Arial; font-size:11pt; -aw-style-name:header }"), Is.True);
```

### See Also

* class [HtmlSaveOptions](../)
* namespace [Aspose.Words.Saving](../../../aspose.words.saving/)
* assembly [Aspose.Words](../../../)
