Views

  • 2 minutes to read

RichEditControl can display documents in three different ways depending on the applied document View.

End users can click the Document Views buttons on the View ribbon tab to change the active view. Refer to the How to: Create a RichEditControl with a Ribbon UI topic for information on how to provide a Ribbon UI for the RichEditControl.

IMAGE

The table below describes and compares the available views.

Simple View

Draft View

Print Layout View

API

RichEditControl.ActiveViewType set to RichEditViewType.Simple

SimpleView

RichEditControl.ActiveViewType set to RichEditViewType.Draft

DraftView

RichEditControl.ActiveViewType set to RichEditViewType.PrintLayout

PrintLayoutView

Description

Suitable for simple text and web pages. Shows how to the document looks as a website.

Used for text formatting. Shows how the document looks on a monitor.

Used for complex documents. Shows how the document looks as a printout.

Displayed Editor Elements

None

Horizontal Ruler

Horizontal and Vertical Rulers

Paging

Document is not split into pages.

Document is not split into pages.

Document is divided into pages.

Page Layout

No page layout options are applied.

Only the page width is applied. Multiple columns are displayed as a single column.

All page layout options are applied.

Floating Objects Position

Misplaced

Misplaced

Correct

View Options

You can use the RichEditControl.ActiveView property to access the current view. The returned RichEditView options allow you to customize the target view.


richEditControl1.ActiveView.AllowDisplayLineNumbers = true;
richEditControl1.ActiveView.BackColor = System.Drawing.Color.Beige;

Use the RichEditLayoutOptions property to access view-specific options.


RichEditLayoutOptions layoutOptions = richEditControl.Options.Layout;
layoutOptions.PrintLayoutView.MatchHorizontalTableIndentsToTextEdge = true;
layoutOptions.PrintLayoutView.AllowTablesToExtendIntoMargins = true;
NOTE

Set the current view's RichEditView.AdjustColorsToSkins property to true to adapt the RichEditControl's text editing surface elements to the current theme.

You can control the scrollbars' and rulers' visibility for any view. Use the following properties to customize the editing surface appearance:

The code sample below hides all rulers and scrollbars:


RichEditControlOptions richEditControlOptions = richEditControl.Options;

richEditControlOptions.VerticalScrollbar.Visibility  = RichEditScrollbarVisibility.Hidden;
richEditControlOptions.HorizontalScrollbar.Visibility = RichEditScrollbarVisibility.Hidden;

richEditControlOptions.VerticalRuler.Visibility = RichEditRulerVisibility.Hidden;
richEditControlOptions.HorizontalRuler.Visibility = RichEditRulerVisibility.Hidden;