ViewOptions class
ViewOptions class
Provides various options that control how a document is shown in Microsoft Word. To learn more, visit the Work with Options and Appearance of Word Documents documentation article.
Properties
Name | Description |
---|---|
display_background_shape | Controls display of the background shape in print layout view. |
do_not_display_page_boundaries | Turns off display of the space between the top of the text and the top edge of the page. |
forms_design | Specifies whether the document is in forms design mode. |
view_type | Controls the view mode in Microsoft Word. |
zoom_percent | Gets or sets the percentage (between 10 and 500) at which you want to view your document. |
zoom_type | Gets or sets a zoom value based on the size of the window. |
Examples
Shows how to set a custom zoom factor, which older versions of Microsoft Word will apply to a document upon loading.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.writeln('Hello world!')
doc.view_options.view_type = aw.settings.ViewType.PAGE_LAYOUT
doc.view_options.zoom_percent = 50
self.assertEqual(aw.settings.ZoomType.CUSTOM, doc.view_options.zoom_type)
self.assertEqual(aw.settings.ZoomType.NONE, doc.view_options.zoom_type)
doc.save(file_name=ARTIFACTS_DIR + 'ViewOptions.SetZoomPercentage.doc')
Shows how to set a custom zoom type, which older versions of Microsoft Word will apply to a document upon loading.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.writeln('Hello world!')
# Set the "ZoomType" property to "ZoomType.PageWidth" to get Microsoft Word
# to automatically zoom the document to fit the width of the page.
# Set the "ZoomType" property to "ZoomType.FullPage" to get Microsoft Word
# to automatically zoom the document to make the entire first page visible.
# Set the "ZoomType" property to "ZoomType.TextFit" to get Microsoft Word
# to automatically zoom the document to fit the inner text margins of the first page.
doc.view_options.zoom_type = zoom_type
doc.save(file_name=ARTIFACTS_DIR + 'ViewOptions.SetZoomType.doc')
See Also
- module aspose.words.settings
- class Document
- property Document.view_options