Adjust text overflow in cells

This article explains how to adjust text-overflow in cells when viewing Spreadsheets with GroupDocs.Viewer within you .NET applications.


When Spreadsheet is rendered overflowed text inside the cell overlays subsequent cells until it meets non-empty cell. GroupDocs.Viewer provides a setting to configure the mode which will be used for rendering overflowed text:

  1. To set the overflowed text to be hidden, set SpreadsheetOptions.TextOverflowMode of HtmlViewOptions class to HideText as shown in the example below.
  2. To set the overflowed text to overlay subsequent cells until it meets non empty cell, set SpreadsheetOptions.TextOverflowMode of HtmlViewOptions object to OverlayIfNextIsEmpty. This is a default value.
  3. To set the overflowed text to overlay subsequent cells even they are not empty, set SpreadsheetOptions.TextOverflowMode of HtmlViewOptions objectto Overlay.
  4. To expand the cell width to fit overflowed text, set SpreadsheetOptions.TextOverflowMode of HtmlViewOptions object to AutoFitColumn

NOTE: The same workflow is applicable for JpgViewOptionsPngViewOptions, and PdfViewOptions classes;

How to adjust text overflow in cells 

The following steps are required to manage text-overflow:

The following code sample shows how to hide text in case it overflows cell.

            using (Viewer viewer = new Viewer("sample.xlsx"))
                HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
                viewOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.HideText;

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.