https://bugs.documentfoundation.org/show_bug.cgi?id=164874

            Bug ID: 164874
           Summary: [FORMATTING]
           Product: LibreOffice
           Version: 24.8.4.2 release
          Hardware: ARM
                OS: macOS (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Updating the Page Style to Landscape via the API will not export the file as
Landscape if Portrait was the selection before.

If I open up a connection to LibreOffice through the soffice listener

```
 cmd = [
            "soffice",
            "--headless",
            f"--accept=socket,host={HOST},port={PORT};urp;",
        ]
```

Then get the document in Python through uno

```

local_context = uno.getComponentContext()
resolver = local_context.ServiceManager.createInstanceWithContext(
                "com.sun.star.bridge.UnoUrlResolver", local_context
)
context = resolver.resolve(
    f"uno:socket,host={HOST},port={PORT};urp;StarOffice.ComponentContext"
)

# Get the Desktop instance
desktop = context.ServiceManager.createInstanceWithContext(
                "com.sun.star.frame.Desktop", context
            )
document = desktop.loadComponentFromURL(
                    file_path
                )
```

Then with Python update the page style to Landscape

```
style_familes = document.getStyleFamilies()
for style_name in style_familes.PageStyles:
    page_style = style_familes.PageStyles.getByName(style_name.Name)
    page_style.setPropertyValue("IsLandscape", True)
```

When I look at the file after this piont, through the ui, I can see the page
style for landscape is selected in the UI, but it will not export to PDF when I
use the UI to export or soffice commands.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to