Get Default Load Options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion for Python via .NET enables you to retrieve default load options for specific document formats, useful for setting format-specific defaults at runtime.

To obtain default load options for a document format, use the get_possible_conversions_by_extension method, passing the source document’s file extension (e.g., "docx" for Word documents). This example demonstrates how to retrieve the default load options.

from groupdocs.conversion import Converter
from groupdocs.conversion.options.load import WordProcessingLoadOptions

def get_default_load_options():
    # Step 1: Retrieve possible conversions for a DOCX extension
    possible_conversions = Converter.get_possible_conversions_by_extension("docx")

    # Step 2: Use the default load options 
    default_load_options = possible_conversions.load_options

    # You can also instantiate load options by yourself
    word_processing_load_options = WordProcessingLoadOptions()

if __name__ == "__main__":
    get_default_load_options()

Explanation

  • Retrieve Default Load Options: The get_possible_conversions_by_extension method returns possible conversions along with default load options for a specified format.
  • Using Default Load Options: The default_load_options object holds settings that can be used directly for initializing conversions.
  • Manual Load Options Initialization: Alternatively, you can create specific load options (e.g., WordProcessingLoadOptions) manually if customization is required.

By retrieving and using these default settings, you can streamline conversions while preserving format-specific options.

For further details, consult the API Reference.