How to show spreadsheet 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.
Background
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.
Solution
To show of column and row headings in the output document you just need to set HtmlViewOptions (or JpgViewOptions, or PngViewOptions, or PdfViewOptions) object SpreadsheetOptions.RenderHeadings property to true
The following code sample shows how to enable rendering of column and row headings (this example can be also found in our public examples repository.)
using (Viewer viewer = new Viewer("sample.xlsx"))
{
HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
viewOptions.SpreadsheetOptions.RenderHeadings = true;
viewer.View(viewOptions);
}
When headings rendering is enabled, the spreadsheet HTML view in a browser will contain row and column headings as shown in the screenshot below.
More resources
View Excel Files Online
Along with full-featured .NET library we provide simple but powerful free online Apps. View Excel XLS, XLSX, and XLSB files online with GroupDocs Viewer App.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for .NET examples, plugins, and showcase
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET MVC UI Example
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example