Copy link to clipboard
Copied
I'm trying to set the column widths of a table in framemaker by importing the width from an attribute in the imported xml file. But it doesn't work...
This is from my read/write rules:
element "ITEM-CELL-LIST"
{
is fm table cell element;
attribute "width" is fm property column width;
fm property column width value is "2cm";
}
The last line that specifies the width to 2cm seems to be accepted as I can save the EDD as DTD without errors, but it has no effect on the actual widths of the table created.
The line above it doesn't work at all. When I try to save the EDD, I get the following error: "Invalid property specified for the element (ITEM-CELL-LIST)."
I've tried every way I can think of, but nothing seems to work
The only way I've been able to actually set the widths is by creating a table in the master template page and resizing the columns. That carries over to the imported xml.
Rudi,
Ah, no problem. Don't set the widths in r/w rules but in an attribute on the <table> element, something like:
XML1:
<table widths="10mm 10mm 20mm 10mm 10mm">
<row>
<cell/>
<cell/>
<cell/>
<cell/>
<cell/>
</row>
</table>
XML2:
<table widths="10mm 20mm 10mm 20mm 10mm">
<row>
<cell/>
<cell/>
<cell/>
<cell/>
<cell/>
</row>
</table>
You didn't mention what units you are using, so I guessed mm.
...Copy link to clipboard
Copied
Rudi,
Check the Structured Application Developer Reference for information on what properties are supported for the various types of elements. FrameMaker does not support a width attribute for an individual table cell, which makes sense since such an attribute would allow different widths to be specified for different cells in the same column and it's not clear how such values should be interpreted.
Instead, FrameMaker allows a column width on the table element itself. The value is a space-separated list of the widths of success columns.
--Lynne
Copy link to clipboard
Copied
Thank you for replying Lynne!
Yes, that would work if I knew which width I want to set from left to right.
But what if I have two wide columns, then three narrower in one xml and three wide, then two narrow in the next?
Isn't there any way to set the width by an attribute in the xml?
Copy link to clipboard
Copied
Rudi,
I don't understand what you mean by "in one xml"? Do you mean a cell element? How do you know which column contains a particular cell? If the cells do not occur in the XML document in left-to-right order, then use XSLT to calculate the widths of successive cells and set a column widths attribute for the table element accordingly.
Good luck.
--Lynne
Copy link to clipboard
Copied
Hi!
What I mean is that different xml files that I have to import to framemaker may have slightly different number of columns, with varying widths, in a table.
Such as:
XML1:
<table>
<row>
<cell width="10">
<cell width="10">
<cell width="20">
<cell width="10">
<cell width="10">
</row>
</table>
XML2:
<table>
<row>
<cell width="10">
<cell width="20">
<cell width="10">
<cell width="20">
<cell width="10">
</row>
</table>
That means I can't just set the widths in r/w rules like: "10 10 20 10 10", I need to read the attributes from the xml files and import them as framemaker property values.
"If the cells do not occur in the XML document in left-to-right order, then use XSLT to calculate the widths of successive cells and set a column widths attribute for the table element accordingly."
So, I set the column widths as a space-delimited attribute in the table element?
"How do you know which column contains a particular cell?"
I understand that setting the width of individual cells in a table could get confusing. But when using the "resize columns..." in framemaker, you can select just one cell, and all the cells in that column will resize with it.
That's why I thought it might work to do the same in r/w rules.
Another thing I tried is to add a COLSPEC element to my xml, but I can't get that to work either...
Copy link to clipboard
Copied
Rudi,
Ah, no problem. Don't set the widths in r/w rules but in an attribute on the <table> element, something like:
XML1:
<table widths="10mm 10mm 20mm 10mm 10mm">
<row>
<cell/>
<cell/>
<cell/>
<cell/>
<cell/>
</row>
</table>
XML2:
<table widths="10mm 20mm 10mm 20mm 10mm">
<row>
<cell/>
<cell/>
<cell/>
<cell/>
<cell/>
</row>
</table>
You didn't mention what units you are using, so I guessed mm. Alternatively, you can use proportional widths, by using an asterisk as the unit:
<table widths="10* 20* 10* 20* 10*">
This variation tells FM to use the entire available space (width of the column or page, as determined by the pgwide attribute) and to divide it up so that columns 2 and 4 are twice as wide as the other columns.
You can use <colspec> elements if you are using CALS tables, in particular, if you have a <tgroup> element.
--Lynne
Copy link to clipboard
Copied
Rudi,
I forgot to mention that you will need a r/w rule for your table element, such as:
element "table" {
is fm table;
attribute "widths" is fm property column widths;
}
--Lynne
Copy link to clipboard
Copied
<table widths="10* 20* 10* 20* 10*">
and:
element "table" {
is fm table;
attribute "widths" is fm property column widths;
}
is the correct answer...
Copy link to clipboard
Copied
Hi Lynne,
I'm having the similar problem.
After commenting off the proportional width, table element got translated correctly. Simpletable remains problematic. How are these two treated differently?
Regards,
Andy
Find more inspiration, events, and resources on the new Adobe Community
Explore Now