[Solved] Set columns and rows autofix with code

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
luofeiyu
Posts: 53
Joined: Thu Sep 14, 2017 2:11 am

[Solved] Set columns and rows autofix with code

Post by luofeiyu »

Set columns and rows autofix manually:

format--rows--optional height
format--columns--optional width

How can set columns and rows autofix with code?
Suppose that there are many ods file in the directory `data`,every ods workbook contains 10 worksheets in it.
Last edited by luofeiyu on Sat Feb 01, 2025 5:21 am, edited 1 time in total.
LibreOffice 7.4.7.2 on Debian 12
User avatar
Zizi64
Volunteer
Posts: 11477
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Set columns and rows autofix with code

Post by Zizi64 »

Code: Select all

ThisComponent.sheets(0).columns(0).optimalwidth = true
You can organize this API function into a program loop.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Locked