export_report_as_html#

ADR.export_report_as_html(output_directory: str | Path, *, filename: str = 'index.html', dark_mode: bool = False, context: dict | None = None, item_filter: str = '', **kwargs: Any) Path#

Export a report as a standalone HTML file (plus assets).

Parameters:
output_directorystr or Path

Directory where the report will be exported. It is created if it does not exist.

filenamestr, default: “index.html”

Name of the HTML file within output_directory.

dark_modebool, default: False

If True, the report is rendered using a dark theme (where supported).

contextdict, optional

Context to pass to the report template.

item_filterstr, optional

ADR filter applied to items in the report.

**kwargsAny

Additional keyword arguments to pass to fetch the report template. Eg: guid, name, etc. At least one keyword argument must be provided to fetch the report.

Returns:
Path

Path to the generated HTML file.

Raises:
ADRException

If no keyword arguments are provided or if the static directory is not configured.

ImproperlyConfiguredError

If the static directory is not configured or if the output directory cannot be created.

Examples

>>> from ansys.dynamicreporting.core.serverless import ADR
>>> adr = ADR(
            ansys_installation=r"C:\Program Files\ANSYS Inc\v252",
            db_directory=r"C:\DBs\docex",
            media_directory=r"C:\DBs\docex\media",
            static_directory=r"C:\static"
        )
>>> adr.setup(collect_static=True)
>>> output_path = adr.export_report_as_html(
            Path.cwd() / "htmlex",
            context={},
            item_filter="A|i_tags|cont|dp=dp227;",
            name="Serverless Simulation Report",
        )