Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Printing in balanced columns


This topic is 6981 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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))

Posted

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

Posted

[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.

Posted

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.

Posted

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.

Posted

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.

Posted

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

This topic is 6981 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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