[Solved] Evenly distribute text to columns

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
jwharton
Posts: 4
Joined: Wed Nov 09, 2022 5:18 am

[Solved] Evenly distribute text to columns

Post by jwharton »

I would like to turn off the default behavior of having text evenly distributed across columns.
I scoured through the API documentation and could not find the name of the property to do it.
Is there a way to accomplish this via the API?

Thanks!

Jason Wharton
Last edited by MrProgrammer on Sun Mar 26, 2023 6:17 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
LibreOffice 6.2.3.2 on Windows 64
FJCC
Moderator
Posts: 9280
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: API: columns: evenly distribute text issue

Post by FJCC »

Please provide more details. Which application are you talking about?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: API: columns: evenly distribute text issue

Post by Zizi64 »

I would like to turn off the default behavior of having text evenly distributed across columns.
I scoured through the API documentation and could not find the name of the property to do it.
Is there a way to accomplish this via the API?
If you meant the Columns of the Writer:

The text in the columns of a Writer document always will flow to the next column on a specific page. You can not control the text to flow from the first column of a page to the first column of the next page. There is not way to do this (I think).

You must use a Table in the writer document for this task. It is a workaround only...
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.
jwharton
Posts: 4
Joined: Wed Nov 09, 2022 5:18 am

Re: API: columns: evenly distribute text issue

Post by jwharton »

What I am talking about is in Writer where you can have multiple columns and control the behavior of how the text flows in them. One way it keeps them balanced out side by side. The other way fills the one column entirely before putting anything in the other column.

I have attached a screenshot of where it can be controlled via the settings.
ColumnsDistributeText.png
ColumnsDistributeText.png (14.45 KiB) Viewed 909 times
LibreOffice 6.2.3.2 on Windows 64
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: API: columns: evenly distribute text issue

Post by JeJe »

The macro record function gives the same result whether that's ticked or not - so it looks to be only available via the dialog.

You might be able to open the dialog and manipulate it using the Accessible Context of the dialog - it would be difficult, see Useful Macro Information
For OpenOffice.org By Andrew Pitonyak

An alternative might be write your own routine to do the moving.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: API: columns: evenly distribute text issue

Post by Zizi64 »

I just discovered that handling multiple columns in body text and in the sections is fundamentally different in this point of view. (Same in the AOO an in LO.)
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.
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: API: columns: evenly distribute text issue

Post by ms777 »

... try the below code. The first one requires the cursor being in the multi column section

Good luck

ms777

Code: Select all

Sub Main
oDoc = ThisComponent
oSection = oDoc.currentSelection.getByIndex(0).TextSection
oSection.DontBalanceTextColumns = not oSection.DontBalanceTextColumns
msgbox oSection.DontBalanceTextColumns
End Sub

Code: Select all

Sub Main
oDoc = ThisComponent
with oDoc.TextSections
	for i=0 to .Count-1
		.getByIndex(i).DontBalanceTextColumns = false
	next i
end with
End Sub
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: API: columns: evenly distribute text issue

Post by Lupp »

There is no OpenOffice 6.2. The current "still" version of LibreOffice is 7.3.7.

The addressed issue is one of th UI. The actual balancing of contents for an existing TextSection is ruled by the attribute .DontBalanceTextColumns of the section object as @ms777 already showed.

As far as I can see, the 'Expert Configuration' also doesn't offer a switch making the "other" setting the default.
Relevant and consistent enhancement would require the implementation of Section styles.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
jwharton
Posts: 4
Joined: Wed Nov 09, 2022 5:18 am

[Solved] Re: API: columns: evenly distribute text issue

Post by jwharton »

.DontBalanceTextColumns is exactly what I needed!

I attached a screen shot of version that I am using.

Thanks everyone!
Jason Wharton
Attachments
LibreOfficeAboutScreenShot.png
LibreOfficeAboutScreenShot.png (23.73 KiB) Viewed 768 times
LibreOffice 6.2.3.2 on Windows 64
Post Reply