Rendering column and row headings


Excel worksheet columns and rows numeration are described by letters (A, B, C, etc.) for columns and by numbers (1, 2, 3, etc.) for rows, numeration is located in headings of Excel worksheet. The column headings are used to identify the column and row numbers are used to identify the row in the worksheet. The combination of the column letter and the row number (A1, D3, F7, etc.) is called cell reference and used to identify the cell in the worksheet. 

The column and row headings are highlighted in the following screenshot. 


Let’s take a sample workbook and open it with Excel. Then we’ll process the same file with GroupDocs.Viewer and compare results.

The following screenshot shows the default spreadsheet view in Excel.

When processing spreadsheets with GroupDocs.Viewer the row and column headings are not shown by default.

The following screenshot shows the default spreadsheet HTML view in a browser. 

How to show spreadsheet column and row headings

This feature is supported when rendering worksheets into a single page when SpreadsheetOptions is set to SpreadsheetOptions.forOnePagePerSheet().

To show of column and row headings in the output document you just need to set setRenderHeadings() property of HtmlViewOptions, JpgViewOptionsPngViewOptions or PdfViewOptions object to true

The following code sample shows how to enable rendering of column and row headings.

    try (Viewer viewer = new Viewer("sample.xlsx")) {
        HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();

When headings rendering is enabled, the spreadsheet HTML view in a browser will contain row and column headings as shown in the screenshot below.