• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I save widths of columns in a table in XML documents?

New Here ,
Jan 14, 2019 Jan 14, 2019

Copy link to clipboard

Copied

Hello everyone!

Please help me understand what I need to do if I want ... tables of the same type in my XML document keep different column widths.

1) I use FM 2017 and have a book with XML files, so I use a DTD and EDD files to design my document.

2) I added to  EDD a new type of table and updated DTD.

3) As a result, I can add this new table in a document, but I cannot save widths of columns. If I close the document and reopen it, the widths of columns have default settings which I set in structure template for Table format. I cannot predict what column widths I will need for future tables, so I would like to be able to adjust the width of the columns for each individual table and save these settings after closing the document. How can I do it? Is it possible?

TOPICS
Structured

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jan 15, 2019 Jan 15, 2019

Copy link to clipboard

Copied

Hi oksanag21296527,

It is definitely possible, as this is a basic artifact of formatting. Without it, XML import/export would be hardly useful, at least within an application focused on WYSIWYG layout.

Having said that, it has been a long time since I set up a structured app to do this, so I don't remember all the details. My best advice is to study the Structure Developers Guide, because I know the information is in there. It's how I figured it out originally.

I can share some things, maybe these will help a little bit. Here are the read/write rules I use that are related to table elements:

element "tgroup"

{

  is fm table element;

  attribute "cols" is fm property columns;

  attribute "outputclass" is fm property table format;

  attribute "colsep" is fm property column ruling;

  attribute "rowsep" is fm property row ruling;

}

element "colspec"

{

  is fm colspec;

  attribute "colnum" is fm property column number;

  attribute "colname" is fm property column name;

  attribute "align" is fm property cell alignment type;

  attribute "charoff" is fm property cell alignment offset;

  attribute "char" is fm property cell alignment character;

  attribute "colwidth" is fm property column width;

  attribute "colsep" is fm property column ruling;

  attribute "rowsep" is fm property row ruling;

}

element "spanspec"

{

  is fm spanspec;

  attribute "spanname" is fm property span name;

  attribute "namest" is fm property start column name;

  attribute "nameend" is fm property end column name;

  attribute "align" is fm property cell alignment type;

  attribute "charoff" is fm property cell alignment offset;

  attribute "char" is fm property cell alignment character;

  attribute "colsep" is fm property column ruling;

  attribute "rowsep" is fm property row ruling;

}

Note that I generally follow the CALS model. More specifically, my schema is valid against the DITA <topic> DTD, although I'm not using DITA. Looking at these rules, it seems I have lots of stuff in there that is not used. But for sure, the column widths get saved. It looks like this in the XML:

<tgroup outputclass="Normal_Title" id="QPXDYXEQ" cols="4" colsep="0" rowsep="1">

<colspec colname="1" colnum="1" colsep="0" colwidth="0.505in"/>

<colspec colname="2" colnum="2" colsep="0" colwidth="1.074in"/>

<colspec colname="3" colnum="3" colsep="0" colwidth="1.563in"/>

<colspec colname="4" colnum="4" colsep="0" colwidth="2.727in"/>

<thead>

...

I hope this helps some. Somebody who does this on a regular basis could provide more expertise. For example, it may be possible without the extra <colspec> elements. I don't have time to research it all again myself.

Russ

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2019 Jan 16, 2019

Copy link to clipboard

Copied

Hi Oksana,

Basically, as Russ showed, you need to provide a read/write rule to convert your column width to an attribute value.

Russ brings up a great point about your content model...can you tell us what that model is? DITA, iSpec, mil-std?

The specifics of how you manage it are dependent on that content model.

-Matt

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 22, 2019 Jan 22, 2019

Copy link to clipboard

Copied

LATEST

Hi

We have a kind of roll-your-own table definition. A really simple table could look like this:

<table cols="n" colwidths="x,y">

<tt>Table title</tt>

<th><tr><td>head 1</td><td>head 2</td></tr></th>

<tb><tr><td>cell 1</td><td>cell 2</td></tr></tb>

<tf><tr><td>footer 1</td><td>footer 2</td></tr></tf>

</table>

Any of the td elements can have a colspan and/or rowspan attribute for cells which stretch across multiple columns or down multiple rows.

Our rules are these:

element "table" {

  is fm table element;

  attribute "cols" is fm property columns;

  attribute "colwidths" is fm property column widths;

}

element "tt" {

   is fm table title element;

}

element "th" {

   is fm table heading element;

}

element "tb" {

   is fm table body element;

}

element "tf" {

   is fm table footer element;

}

element "tr" {

   is fm table row element;

}

element "td" {

   is fm table cell element;

   attribute "colspan" is fm property horizontal straddle;

   attribute "rowspan" is fm property vertical straddle;

}

Perhaps this helps?

Cheers

T

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines