load method

load(file_name)

Loads font fallback settings from XML file.

def load(self, file_name: str):
    ...
ParameterTypeDescription
file_namestrInput file name.

load(stream)

Loads fallback settings from XML stream.

def load(self, stream: io.BytesIO):
    ...
ParameterTypeDescription
streamio.BytesIOInput stream.

Examples

Shows how to load and save font fallback settings to/from an XML document in the local file system.

doc = aw.Document(file_name=MY_DIR + 'Rendering.docx')
# Load an XML document that defines a set of font fallback settings.
font_settings = aw.fonts.FontSettings()
font_settings.fallback_settings.load(file_name=MY_DIR + 'Font fallback rules.xml')
doc.font_settings = font_settings
doc.save(file_name=ARTIFACTS_DIR + 'FontSettings.LoadFontFallbackSettingsFromFile.pdf')
# Save our document's current font fallback settings as an XML document.
doc.font_settings.fallback_settings.save(file_name=ARTIFACTS_DIR + 'FallbackSettings.xml')

Shows how to load and save font fallback settings to/from a stream.

doc = aw.Document(MY_DIR + 'Rendering.docx')
# Load an XML document that defines a set of font fallback settings.
with open(MY_DIR + 'Font fallback rules.xml', 'rb') as font_fallback_stream:
    font_settings = aw.fonts.FontSettings()
    font_settings.fallback_settings.load(font_fallback_stream)
    doc.font_settings = font_settings
doc.save(ARTIFACTS_DIR + 'FontSettings.load_font_fallback_settings_from_stream.pdf')
# Use a stream to save our document's current font fallback settings as an XML document.
with open(ARTIFACTS_DIR + 'FallbackSettings.xml', 'wb') as font_fallback_stream:
    doc.font_settings.fallback_settings.save(font_fallback_stream)

See Also