Subject: Jade & Tables & RTF questions... From: Oisin McGuinness <oisin@xxxxxxxx> Date: Mon, 22 Sep 97 15:44:44 -0400 |
This is longish, I apologize in advance. I'm in the develop/test stage of a project to convert SGML into RTF for document reuse. After some time looking at various tools, it became extremely clear that the best tool was Jade, especially as it allows me to have fun programming in a new language, and as it minimizes the amount of RTF I have to learn to write! (Thanks to James Clark!) Our documents have made extensive use of tables for all kinds of things, so I'm trying to get the tables translated as accurately as possible. I won't mention the SGML product explicitly here; I think it will become extremely obvious to any users of the system from the examples given below. A few issues have arisen, to which I don't have good solutions. To state them clearly, I'll just give the outline of a small sample table in the SGML format I'm translating from: <table wdm="abs" cwl="1.49in:1.49in"> <rowrule rtl="=:="> <tablerow hdr="1"> <cellrule rty="="> <tablecell chj="c" cvj="t" cts="bi">Manager </tablecell> <cellrule rty="="> <tablecell chj="c" cvj="t" cff="MONO" cts="bf">Employee </tablecell> <cellrule rty="="> </tablerow> <rowrule rtl="=:="> <tablerow rht="0.78in"> <cellrule rty="="> <tablecell chj="l" cvj="t"></tablecell> <cellrule rty="="> <tablecell chj="l" cvj="t"></tablecell> <cellrule rty="="> </tablerow> <rowrule rtl="=:="> </table> My strategy for handling tables in the style sheet is: --- for <table>, parse the width setting, and generate an appropriate number of table-column objects with the correct widths (here explicitly given); ? (Here, since the first row is a designated header, I actually generate a table-part flow object¸ with use of the header port feature, (whose use I learned from the TEILite sheet), but in general just a table.) --- for <tablerow>, just generate a table-row?flow object, labelled appropriately if it's a header. --- for <rowrule>, <cellrule>, do nothing, --- for <tablecell>, do an immense amount of work interrogating neighboring cellrules, rowrules to find out what table-border objects to generate (every cell draws its bottom and right border; those in the first row and column also generate their left and top borders), and eventually do the paragraph thing to the children, with font, style, justifications read from the attributes in <tablecell>. (Thanks to the docbook stylesheet authors for useful quantity parsing and other navigational code ideas!) Here are my problems: 1) RowHeight Forcing: In the example above, the 2nd tablerow has an explicit row height attribute of 0.78in. The intent is that the boxes generated have enough blank space for a stamp to be applied to the resulting paper. In DSSSL there is no such attribute for table-row; see 12.6.27.5. In TeX, I could do this by inserting an invisible vertical rule into the contents of the first cell in the row ; trying the same thing with Jade didn't work (I think this is mentioned in the Jade html page), though there is some code in RtFOTBuilder.cxx?(void RtfFOTBuilder::rule(const RuleNIC &nic)) which seems to want to do something here. I note that if I put an explicit \hrrdN where N=round(0.78*1440) into the generated .rtf file between the \trowd and the \trkeep for this tablerow, then everything looks good. (See void RtfFOTBuilder::outputTable(), partway through; the only stuff interjected between \trowd and \trkeep currently are \trleft and \trq{c,l,r}.) So: does anyone have any better ideas than hacking RtfFOTBuilder.cxx to add an extension to allow rowHeight specifications? Are there easy ways to generate an invisible box of zero with of the correct height that I could insert into a tablecell? 2) Spanning Algorithms: The example above doesn't show it, but the SGML allows horizontal spans and vertical spans. I have things looking good (I did no special work for vertical spans except setting characteristics), but I'm not happy with my algorithm for horizontal spans. If there is spanning, then there might just be two tablecell's given, with spn attributes set, in a table with 5 cols (say). To find the right rules etc. to use, as I move through the cells in a row, for each cell I have to go through all the previous cells, adding up the either explicit or implicit spn attributes, to find the true cell number. This is a quadratic algorithm, it is not a practical problem, but the code would be cleaner if I could find someway of saving the true cell number for each cell as I calculate it. In other words, to update a global list, or a list attached to the row in some way. Any ideas? 3) Table Breaking: I first noticed this with tables where I had a header row set, but then noticed it with tables of any kind, as soon as they got big enough. Even though I set keep: everywhere I can to be #t, Word breaks the table in completely unpredictable ways, except that the first page usually only contains a couple of rows, with oodles of white space left over. Has anyone seen this, and can they suggest characteristic settings to mitigate the problem? Thanks to everyone who has read this far. I especially would like to thank those who've made style sheet examples publically available. Programming in DSSSL/Scheme is fun, and a lot more fun than that JavaScript stuff in XSL is likely to be. By the way, if you recognize the tag format, and you too need to turn this stuff into RTF, I would be glad to share code. Currently my table and list support is quite good, and I'm working on more routine aspects of the unnamed format. (Footnotes anyone??) Oisin McGuinness Sumitomo Bank Capital Markets 277 Park Avenue New York NY 10172 USA (212)-224-4913, email: oisin@xxxxxxxx DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
SPDL, ISO spec 10180, how to make p, Oisin McGuinness | Thread | Re: Jade & Tables & RTF questions.., James Clark |
SPDL, ISO spec 10180, how to make p, Oisin McGuinness | Date | Side effects and large-scale conver, Sam Hunting |
Month |