display_background_shape property
ViewOptions.display_background_shape property
Controls display of the background shape in print layout view.
@property
def display_background_shape(self) -> bool:
...
@display_background_shape.setter
def display_background_shape(self, value: bool):
...
Examples
Shows how to hide/display document background images in view options.
# Use an HTML string to create a new document with a flat background color.
html = "<html>\n <body style='background-color: blue'>\n <p>Hello world!</p>\n </body>\n </html>"
doc = aw.Document(stream=io.BytesIO(system_helper.text.Encoding.get_bytes(html, system_helper.text.Encoding.unicode())))
# The source for the document has a flat color background,
# the presence of which will set the "DisplayBackgroundShape" flag to "true".
self.assertTrue(doc.view_options.display_background_shape)
# Keep the "DisplayBackgroundShape" as "true" to get the document to display the background color.
# This may affect some text colors to improve visibility.
# Set the "DisplayBackgroundShape" to "false" to not display the background color.
doc.view_options.display_background_shape = display_background_shape
doc.save(file_name=ARTIFACTS_DIR + 'ViewOptions.DisplayBackgroundShape.docx')
See Also
- module aspose.words.settings
- class ViewOptions