Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Printing in balanced columns

Featured Replies

I'd like to be able to print my newspaper articles in a two-column format. I know that there is a built-in provision for printing in two columns with the text flowing from column 1 to column 2, but I need for the columns to be "balanced." That is, I want the text in both columns to be approximately the same length.

I have simplistically attempted to do this with two calculated fields (one to extract the left-hand text and the other the right-hand text) that break BodyText, the field containing the article text, into two equal parts based on word count. But the breaks need to be at the end of a sentence and not just where the word counts are equal. Plus, differing lengths of words and paragraphs result in ugly imbalance.

I've also tried to do this with an XLM export to a RTF file. Unfortunately, I haven't been able to get the XLST written properly and don't want to buy a separate program to do it.

Right now I'm making do with a mail merge to a Microsoft Word template set up for balanced columns, and that works OK. But it's mighty cumbersome, and I'd prefer to do it straight in FMP if possible.

I'd wecome any suggestions.

Thanks!

James McAlister

www.BulletinInserts.org

www.james-mc.com

Let us assume you have a article field gArticle. You can get the first half of the text in gArticle using the following calculation:

Middle(gArticle ,1 ,Position(gArticle ,"." , 1 , Mod( PatternCount(gArticle , "." ) , 2 ) ) )

The above calculation would find the number of sentences ending with ".". The it would find a mod such that if there are five sentences, it would result in first three. If there are four then it would result in two sentences.

To show the other half of the article you can use the following calculation:

Right(gArticle ,Length(gArticle)-Length(firstCalculation))

  • Author

Thanks, Sanjai,for the idea! I see what you're suggesting, but i'll need to modify it some to account for "!" and "?" endings, too. Plus, the Mod will return only 0 or 1 depending on whether there the PatternCount is odd or even, so I'll get just the first sentence (for odd) or nothing (for even).

Having seen this, though, another approach comes to mind. Assume that gArticle has 2500 characters. Half of that would be 1250. If I could break the text at the end of the sentence containing the 1250th character, that would just about do it.

Any thoughts on that angle?

Thanks so much for getting back to me.

jm

[color:brown]Position ( Text, ".", Length(Text) / 2, 1) returns the position of the first period after the "middle" of the Text field. One method might be to do the same to find the position of the first occurrence of other punctuation (! or ?) and then use Min() to determine the first occurring sentence ending of those. A problem with this general approach is that periods are used in ways other than to end sentences... so perhaps still more logic is needed. Or perhaps more thinking by others will yield a better way to accomplish this.

Hi,

Yes, it would be much better to find the middle of the text field and then find the neares "." or other special characters. We need to find how are you marking the end of your sentence.

  • Author

Yes, i think I can do this it might work OK. But upon further thought, I really need to break at the end of the paragraph and not the sentence. That should be easier; I'll just look for the paragraph mark.

  • Author

We need to find how are you marking the end of your sentence.

With period, question mark or exclamation point. But I think that it would be cleaner to break at the end of the paragaph. that way paragraphs wouldn't break in funny places across a column.

  • Author

Breaking at the paragraph doesn't work too well because of great differences in paragraph lengths. So now I'm breaking at the next period followed by a space. It's not perfect by any means (differences in mix of characters of differing widths) but it works OK for now.

To make it better I'll try to tackle an XML export transformed to Word or RTF with true balanced columns.

Thanks to all who helped

James

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.