Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2025, 10:27 AM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Default Word line-breaking algorithm

Hi all, sorry if my question is off-topic here.


Word used a very bad algorithm to determine where it can break lines (text justification) which has evolved over time, improved considerably, and I know that it is also possible to use the WordPerfect breaking algorithm.

My question is.
Is it possible to use VBA to modify the justification algorithm/rules used by Word?
If not, would it be possible to do that in some other way?

I’ve searched a lot but found no results. I suppose that means messing with Word’s justification is not possible. Nevertheless, I wanted to check here.
Reply With Quote
  #2  
Old 01-26-2025, 01:14 PM
macropod's Avatar
macropod macropod is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can only choose one of the line-wrap algorithms built into the program itself (e.g. WordPerfect, as you noted).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-26-2025, 01:23 PM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Default

Are there more?
Excluding Word native.

Quote:
Originally Posted by macropod View Post
You can only choose one of the line-wrap algorithms built into the program itself (e.g. WordPerfect, as you noted).
Reply With Quote
  #4  
Old 01-26-2025, 01:44 PM
macropod's Avatar
macropod macropod is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Word changed the justification algorithm with the introduction of Word 2013. Presumably, saving it with compatibility for Word 2010 or earlier will default to the older algorithm.
See: Document.SaveAs2 method (Word) | Microsoft Learn and WdCompatibilityMode enumeration (Word) | Microsoft Learn

As for other justification options, see: WdParagraphAlignment enumeration (Word) | Microsoft Learn. I haven't tried the JustifyHi/Low/Med options, so I can't tell you what they do.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-26-2025, 01:50 PM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Default

This is really new to me. Thank you!

Is there a way to choose between different settings, e.g. to specifically choose wdAlignParagraphJustifyHi?
Reply With Quote
  #6  
Old 01-26-2025, 01:56 PM
macropod's Avatar
macropod macropod is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The WdParagraphAlignment constants apply to the .ParagraphFormat.Alignment property.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-26-2025, 02:25 PM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Smile

Sorry, I am a complete beginner with VBA so I must ask like this. In the specifications you sent me, there were the following:

wdAlignParagraphJustifyLow-Justified with a low character compression ratio.
wdAlignParagraphJustifyHi-Justified with a high character compression ratio.

Is it possible to choose one enumeration and apply it to the whole document/or selected part, or is that something that is not possible to apply?


Quote:
Originally Posted by macropod View Post
The WdParagraphAlignment constants apply to the .ParagraphFormat.Alignment property.
Reply With Quote
  #8  
Old 01-26-2025, 02:29 PM
macropod's Avatar
macropod macropod is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Well, yes, you could do that quite simply with a macro like:
Code:
Sub Demo()
ActiveDocument.Range.ParagraphFormat.Alignment = wdAlignParagraphJustifyLow
End Sub
or you could apply it to selected paragraphs with a macro like:
Code:
Sub Demo()
Selection.Range.ParagraphFormat.Alignment = wdAlignParagraphJustifyHi
End Sub
As I said, though, I haven't tried the JustifyHi/Low/Med options, so I can't tell you what they do.

For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: https://wordmvp.com/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 01-26-2025, 02:33 PM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Default

Thanks for the answer and code.
I will try macros and report back if there is any visible change in the text appearance.
Reply With Quote
  #10  
Old 02-03-2025, 04:45 PM
Milqn Vuk Milqn Vuk is offline Word line-breaking algorithm Windows 10 Word line-breaking algorithm Office 2016
Novice
Word line-breaking algorithm
 
Join Date: Jan 2023
Posts: 13
Milqn Vuk is on a distinguished road
Default

Here is what these options do. They are not substitutes for WordPerfect justification.

Text justified with
Code:
wdAlignParagraphJustifyHi
looks almost left aligned, it is not filling full-text width, while the text justified with normal Word justification, appears to be
Code:
wdAlignParagraphJustifyLow
.
Attached Images
File Type: png Screenshot 2025-02-04 003905.png (54.0 KB, 12 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word line-breaking algorithm Word 2016: Stop merged cells from breaking across pages FiveFingers Word Tables 3 06-26-2024 08:20 PM
Word line-breaking algorithm word erases line bottom in tight line spacing when new line is added ozzzy Word 2 01-21-2021 06:41 AM
Controlling line breaking when using Shrink Text on Overflow catflap Publisher 0 03-08-2018 02:08 AM
Word line-breaking algorithm Sorting algorithm for two dimensional array NobodysPerfect Word VBA 1 04-07-2014 03:58 PM
Formula for algorithm santiago_dl Excel 0 01-11-2012 11:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft