Code Samples: Tables or Graphic Frame?

Combs, Richard richard.combs at Polycom.com
Tue Feb 6 10:27:08 PST 2007


Art Campbell wrote: 

> I use a one-column table with each line of code in its own 
> cell, so it breaks cleanly.
> Easy to import too. 

Steve Rickaby wrote: 
 
> I should point out that it's normally a requirement here for 
> the code to be updatable outside of FrameMaker, hence text 
> insets. Art's method therefore would not work here.

Actually, you can use Art's method with text insets. Briefly: 

1) Create a CodeBlock table format with one column that's the width you
want. Set up the ruling/shading, etc. Remember that each pgf (line of
code) will become a cell, so set up cell margins to give you the
interline spacing desired. 

2) Select File > Import > File, choose the text file containing the
code, and import by reference. 

3) In the Import Text File by Reference dialog, select Convert to Table.


4) In the Convert to Table dialog, select your CodeBlock format. Under
Treat Each Paragraph As, select A Cell, leave Number of Columns set to 1
and Heading Rows set to 0. 

Your text inset becomes a one-column table that can span pages because
each line of code is a cell (you can use the table's Orphan Rows setting
to exercise some control over the pagination). 

There's one "gotcha": I can't find any way to *select* the table or its
rows or column. Find doesn't find that table. Clicking it or trying to
select the anchor always selects the text inset instead. With the text
inset selected, you can change the aspects controlled through the Table
Designer, but you can't control column width, create straddles, or apply
Keep With settings to selected rows. 

Straddles shouldn't be an issue, and if you need various widths, more
table formats solve the problem. But it would be nice to have the Keep
With row settings for more control over pagination. 

Still, it's a good way to address code blocks if you want shading, or
you want code blocks of various widths (line lengths) without defining
multiple code pgfs. 

YMMV. HTH!

Richard


------
Richard G. Combs
Senior Technical Writer
Polycom, Inc.
richardDOTcombs AT polycomDOTcom
303-223-5111
------
rgcombs AT gmailDOTcom
303-777-0436
------







More information about the framers mailing list