General XMetaL Discussion
dvdbdgr September 27, 2010 at 9:37 pm
colwidth attribute with percentage sign (%) and table displaySeptember 27, 2010 at 9:37 pmParticipants 4Replies 5Last Activity 12 years, 4 months ago
A client of ours has a bunch of legacy content that uses percent signs (%) in the colwidth attributes of their CALS tables:
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!Derek Read September 27, 2010 at 10:01 pm
Reply to: colwidth attribute with percentage sign (%) and table displaySeptember 27, 2010 at 10:01 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 ([url=http://www.oasis-open.org/specs/tm9502.html]OASIS CALS spec[/url]) 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.dvdbdgr September 28, 2010 at 4:38 pm
Reply to: colwidth attribute with percentage sign (%) and table displaySeptember 28, 2010 at 4:38 pm
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!Derek Read September 28, 2010 at 5:42 pm
Reply to: colwidth attribute with percentage sign (%) and table displaySeptember 28, 2010 at 5:42 pm
Yes, have a look at the documenation for these APIs:
WritePermittedContainerdvdbdgr September 28, 2010 at 7:25 pm
Reply to: colwidth attribute with percentage sign (%) and table displaySeptember 28, 2010 at 7:25 pm
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.
- You must be logged in to reply to this topic.