Friday, September 16, 2005

 

Text Processing -- Table to Text

This should be easy. At some point in the proceedings, I need to convert the table I started with to text. Given the existence of the convertToText() method, it's a cakewalk. The nature of the table I'm working with is that each row represents all the data about a particular item (that will eventually appear in the catalog), so each cell represents a paragraph (or set of paragraphs) that need to be in sequential order starting at the top-left of the table (except the first row) and proceeding left to right, row by row until the end of the table.

The question is, when to do this in the workflow. We also need to perform a large number of fiddly text conversions: Greek alphabet into the character style Greek (I'm using Myriad Pro for the text which includes the Greek alphabet, but I don't like the look of those glyphs in this context; I'm going to propose to the client that we use Warnock Pro for these characters. We also need to interpret a bunch of html tags for italic, superscript, etc.

One of the advantages of using functions for this kind of thing is that it simplifies reordering the processing. My gut feel is that these kinds of text processing will proceed quicker on a long single story rather than on the large number of cells in a table -- the first table I'm working has 143 rows of 11 columns), but I'll do some timing experiments later to confirm this.

Indeed, it was easy:
function burstTable(theTable) {
 // First, remove the first row
 theTable.rows[0].remove();
 theTable.convertToText("\r","\r");
}

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?