Skip to main content

Chart to Bitmap

The Chart to Bitmap function is used to export a chart in the report workbook to a bitmap image file (.bmp). This can be used to take a chart from the report worksheet and make it available to other applications that can display bitmap images.

This function can be used to generate snippets that can be delivered using the TemplateSnippet method in the XLReporter REST API. The snippet can also be displayed in the dashboards of WIN-911’s Control Center.

Settings

Chart Name

The name of the chart to export the chart to. The browse button (…) opens a list of every configured chart within the workbook to select from. The list is in the format:

Chart Name – Sheet!Range of the chart

If a chart is selected in the list, the worksheet for the chart is activated and the range of the chart is selected to highlight the chart itself.

The chart name is not visible and is typically not set by the user. When a chart is inserted into a worksheet it is given a default name (Chart X where X is a number that starts at 1). However, if the worksheet is copied to another sheet, if the default name is left it can be changed on the new worksheet. To combat this, charts in the template are renamed to a fixed name (xlrX where X is a number that starts at 1) so that chart names are consistent between worksheets.

Note that only charts configured to worksheets are listed. Charts configured on a Chart Sheet cannot be used with this function.

Directory

The directory where the bitmap is saved. If this is left blank, the Reports Directory of the current project is used (as defined in the Project Explorer). If this is not a full path reference, the setting is used as subfolders of the Reports Directory. If any part of the directory does not exist, it is created.

This can be a fixed name or cell reference where the cell reference contains the directory. Fixed names can contain XLReporter Name Types like {YYYY}, {MMM}, etc. See the Name Types chapter for the full list of supported keywords. Note that some keywords, such as {DATIM} contain illegal directory characters when evaluated. These keywords cannot be used for the directory.

If the bitmap is to be used as a snippet, the Directory must either be empty or a fixed name. If the snippet is generated from a report template and instance, the variable {Instance} can be used for Directory in order to create a set of snippets for each instance of the template configured.

File

The name of the bitmap file to export the chart to. If no file extension is specified, .bmp is used.

If this setting is left blank, the bitmap file is named after the target workbook in the format Workbook.bmp. If this is run on demand the target workbook is the name of the template.

Note that keywords for the date and time can be entered for the file name e.g., entering {MMM}_{DD}_{YYYY} will name a report generated on June 1st 2020 as Jun_1_2020.bmp. Note that some keywords, such as {DATIM}, contain illegal file name characters when evaluated. These keywords cannot be used for the file name.

This setting may also be specified as a cell reference.

If the bitmap is to be used as a snippet, the File must either be empty or a fixed name. If the snippet is generated from a report template and instance, the variable {Instance} can be used for File in order to create a set of snippets for each instance of the template configured.

Pixel Format

This defines the pixel format of the rendered bitmap. For details on the available formats and what they mean, see the Microsoft documentation for the System.Drawing.Imaging.PixelFormat enumeration.

Example

A daily report is generated to report on plant downtime and includes a pie chart showing the distribution of downtime reasons for the day (chart is named xlr1). To render the chart as a bitmap image that can then be displayed on a dashboard, the following would be configured:

Setting

Value

Chart Name

xlr1

Directory

File

Pixel Format

No Format