Pages: 1
Print
Author Topic: colwidth attribute with percentage sign (%) and table display  (Read 1524 times)
dvdbdgr
Member

Posts: 5


« on: September 27, 2010, 03:37:19 PM »

Hello,

A client of ours has a bunch of legacy content that uses percent signs (%) in the colwidth attributes of their CALS tables:

<colspec colname="col1" colwidth="50%"/>
<colspec colname="col2" colwidth="50%"/>

XMetaL doesn't currently support displaying tables with attributes defined like this.  Would it be possible to implement something so that XMetaL treats the percentage sign just like an asterisk (*)?  Newer tables that use the asterisk are displayed correctly.

We are unable to switch the % signs to asterisks in a macro, because most of the content in a document being viewed is read-only.  I know from reading through the forums that the CSS width attribute is not really supported. 

We're trying to avoid having to convert the legacy docs to use the asterisk.  Any help would be greatly appreciated!

Thanks!
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1534



WWW
« Reply #1 on: September 27, 2010, 04:01:10 PM »

XMetaL supports the CALS spec for CALS editing, and so does not support this. The proper way to denote proportional widths for CALS tables (OASIS CALS spec) is to use the asterisk.

The only solution for this that I can think of is to convert the % symbols to asterisks. I could log a feature request for this but it is unlikely to be implemented anytime soon as I suspect this is a unique requirement for this client only (ie: not of much use to anyone else) because we have not had any other requests to date along similar lines. I will note it however in case it does begin to come up as a frequent request.

I'm not sure I understand the read-only issue. For documents that are read-only could you not simply make the replacements after the document is open? This would not affect the document on disk and the user would not be saving a read-only document (I assume) unless perhaps they use SaveAs, but it sounds like you are OK with having them use asterisks in "new" documents (
Save As creates a new document).

You would probably use the event On_Document_Open_Complete to run your macro and then either Range or DOM calls to replace CALS attributes containing the questionable characters (%) with new values containing asterisks (*). If absolutely necessary you could keep track of whether the document was "legacy" (ie: were changes made?) and then revert those changes before saving if absolutely necessary (say perhaps for legacy documents that are not read-only). There is an On_Before_Document_Save event for that purpose.
Logged
dvdbdgr
Member

Posts: 5


« Reply #2 on: September 28, 2010, 10:38:11 AM »

Hi Derek,

I wrote a little macro to do the replacement.  It runs on On_Document_Open_Complete - and it works great on nodes in the document that are not read-only.  The nodes in the document that are read-only (and greyed out in the editor view) throw up the following error when I try to set the colwidth attribute:

Description: Error: Element node is read-only.

Isn't that to be expected?  Is there a way to temporarily set the read-only container node to writable, then switch it back?

Thanks again!
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1534



WWW
« Reply #3 on: September 28, 2010, 11:42:21 AM »

Yes, have a look at the documenation for these APIs:

ReadOnlyContainer
WritePermittedContainer
Logged
dvdbdgr
Member

Posts: 5


« Reply #4 on: September 28, 2010, 01:25:43 PM »

Derek,

I am able to unset the read-only flag, change the colspec attributes from using % to *, then re-set the read-only flag using ReadOnlyContainer.  It appears to work as expected.

Thanks again!

Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1534



WWW
« Reply #5 on: September 28, 2010, 03:26:13 PM »

Nice. Thanks for closing this thread off.
Logged
Pages: 1
Print
Jump to:  

email us