Q How do I perform text-wrapping and justification in VB or VBA?
A Visual Basic has no intrinsic word-processing capability. This project shows how lateral thinking leads to a solution.
The example VB project contains …
modMainfrmMainclsTransformer
The Main() subroutine pops the form, which contains a multi-line edit box and a Process button …
When you click the Process button, the code takes the text from the edit box, wraps it, and writes it to a text file. The result looks something like this …
Example provided by LA Solutions. Type multi line text here ... Type multi line text here ... Type multi line text here ... Type Internal paragraph tags are respected multi line text here ... Type multi line text here ... Type multi line text here ... Elephants are grey. Type multi line text here ... Type multi line text here ... Example provided by LA Solutions.
The text wrap and justification is performed by XML technology, in the form of an XSLT processor.
The processor transforms raw text into wrapped text. The XML technology that accomplishes this is
encapsulated in the clsTransform class. You can move the class to another project by
copying the module, or maybe you could compile it as a COM DLL.