Retrieve and Update Presentation View Properties in .NET

Introduction

In PowerPoint’s normal view, the slide appears between a side pane for thumbnails or an outline and a notes pane below. Aspose.Slides for .NET exposes the presentation’s saved editing preferences through Presentation.ViewProperties. These include the pane layout, zoom levels, grid spacing, and comment visibility.

About INormalViewProperties

Use NormalViewProperties to access the INormalViewProperties interface. ShowOutlineIcons controls whether icons appear beside slide titles in the outline. SnapVerticalSplitter lets the side pane snap to its minimized state when the user narrows it. PreferSingleView indicates a preference for displaying one pane in the full window.

VerticalBarState controls the divider between the side pane and the slide. HorizontalBarState controls the divider above the notes pane. Both accept a SplitterBarStateType value of Minimized, Maximized, or Restored.

About Restoring INormalViewProperties

When a divider is restored, RestoredLeft supplies the saved size of the side pane and RestoredTop supplies the saved size of the upper slide area. Both expose INormalViewRestoredProperties. Its DimensionSize property accepts a percentage from 0 to 100, and AutoAdjust controls whether the editor adjusts the size when the window is resized.

This example updates an existing presentation. It restores the horizontal divider, sets RestoredTop to 80% with automatic adjustment enabled, and maximizes the vertical divider. It also enables ShowOutlineIcons for outline view.

using Aspose.Slides;
using Aspose.Slides.Export;

using var presentation = new Presentation("demo.pptx");

var normalView = presentation.ViewProperties.NormalViewProperties;
normalView.HorizontalBarState = SplitterBarStateType.Restored;
normalView.VerticalBarState = SplitterBarStateType.Maximized;
normalView.RestoredTop.AutoAdjust = true;
normalView.RestoredTop.DimensionSize = 80;
normalView.ShowOutlineIcons = true;

presentation.Save("presentation_normal_view_state.pptx", SaveFormat.Pptx);

Set the Default Zoom Value

SlideViewProperties and NotesViewProperties store independent zoom settings for the editor. These settings do not affect slide dimensions, slide-show playback, or image export resolution.

This example opens an existing presentation and enables VariableScale to fit the slide to the editing window. For the notes page, it disables automatic scaling and sets Scale to a fixed 80% zoom.

using Aspose.Slides;
using Aspose.Slides.Export;

using var presentation = new Presentation("demo.pptx");

var viewProperties = presentation.ViewProperties;
viewProperties.SlideViewProperties.VariableScale = true;
viewProperties.NotesViewProperties.VariableScale = false;
viewProperties.NotesViewProperties.Scale = 80;

presentation.Save("zoom.pptx", SaveFormat.Pptx);

Set the Grid Spacing

GridSpacing sets the distance between editing grid lines throughout the presentation. It takes a positive value in points, with 72 points per inch. This example prints the current spacing in an existing presentation and saves a quarter-inch grid by setting the interval to 18 points.

using System;
using Aspose.Slides;
using Aspose.Slides.Export;

using var presentation = new Presentation("demo.pptx");

var viewProperties = presentation.ViewProperties;
Console.WriteLine($"Current grid spacing: {viewProperties.GridSpacing} points");

viewProperties.GridSpacing = 18f;
presentation.Save("grid-spacing.pptx", SaveFormat.Pptx);

The grid repeats at a fixed interval. Drawing guides mark individual horizontal or vertical positions. Both are editing aids and appear only in editors that display them. Slide shows and exports to PDF, images, or SVG omit them.

Show or Hide Comments When Opening a Presentation

ShowComments stores a preference that compatible editors use when opening the presentation. For an existing presentation with comments, this example prints the current setting and saves a copy with comments hidden. It also sets LastView to ViewType.SlideView so the copy opens in slide view.

using System;
using Aspose.Slides;
using Aspose.Slides.Export;

using var presentation = new Presentation("comments.pptx");

var viewProperties = presentation.ViewProperties;
Console.WriteLine($"Current comment visibility: {viewProperties.ShowComments}");

viewProperties.ShowComments = NullableBool.False;
viewProperties.LastView = ViewType.SlideView;
presentation.Save("comments-hidden.pptx", SaveFormat.Pptx);

Hiding comments preserves their text, authors, positions, replies, and statuses. To change the comments themselves, see Presentation Comments. Export settings control whether comments appear in PDF, HTML, images, notes, or handouts.

FAQ

Why is the grid hidden when I reopen the presentation?

The presentation stores the grid interval. To see the grid, enable grid visibility in the editor.

Does clearing drawing guides change the grid spacing?

No. Adding, moving, or clearing a guide leaves the grid interval unchanged.

Can different sections of a presentation have different view settings?

No. Presentation.ViewProperties applies to the entire presentation.

Can I save different view settings for different users?

The file stores one set of view properties for everyone. An editor may also apply a user’s local preferences.

Can I save view settings in a template?

Yes. Presentations created from the template inherit its saved view settings.