CALS Table functions
Having trouble installing Oxygen? Got a bug to report? Post it all here.
CALS Table functions
Hi Team,
I working on table functionality in web author.
Need your help to understand and use the proper existing class of table operations for the below functionalities.
Using CALS table.
Insert column to existing table
Insert row to existing table
Delete row from existing table
Delete column from existing table.
Thanks & Regards
Shilpa.P
I working on table functionality in web author.
Need your help to understand and use the proper existing class of table operations for the below functionalities.
Using CALS table.
Insert column to existing table
Insert row to existing table
Delete row from existing table
Delete column from existing table.
Thanks & Regards
Shilpa.P
Re: CALS Table functions
Hi Shilpa,
We recently created a sample plugin that offers the following CALS Table support for any XML document in Web Author:
- table rendering
- specific actions are added before each table to insert or delete rows and columns and to join or split cells
- multiple rows and columns can be selected (by mouse drag or click on column header markers) to easily copy or move table data by using copy/paste
Here is the web-author-CALS-table-plugin:
https://github.com/oxygenxml/web-author ... ble-plugin
You can use it for your customization and tell us if there is some functionality that is missing for you and you do not know how it can be implemented.
Best Regards,
Mihaela
We recently created a sample plugin that offers the following CALS Table support for any XML document in Web Author:
- table rendering
- specific actions are added before each table to insert or delete rows and columns and to join or split cells
- multiple rows and columns can be selected (by mouse drag or click on column header markers) to easily copy or move table data by using copy/paste
Here is the web-author-CALS-table-plugin:
https://github.com/oxygenxml/web-author ... ble-plugin
You can use it for your customization and tell us if there is some functionality that is missing for you and you do not know how it can be implemented.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: CALS Table functions
Hi Mihaela,
I have added code [image 1] which you mentioned in previous post in my plugin and getting exception [image 2].
Please do the needfull.
Thanks & Regards
Shilpa.P
I have added code [image 1] which you mentioned in previous post in my plugin and getting exception [image 2].
- image.png (45.67 KiB) Viewed 1646 times
- image.png (31.54 KiB) Viewed 1646 times
Thanks & Regards
Shilpa.P
Re: CALS Table functions
Hello,
Can you please provide a sample XML for which you can reproduce this exception?
Also please specify where is the caret when you invoke the Insert Column operation.
Thank you!
Best Regards,
Mihaela
Can you please provide a sample XML for which you can reproduce this exception?
Also please specify where is the caret when you invoke the Insert Column operation.
Thank you!
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: CALS Table functions
Hi Miheala,
Please find below table structure.
<tbl ID="tbl5" maxsize="default">
<table colsep="0" rowsep="0"><?ctbl ampex.cols='2'?>
<tgroup cols="2"><?ctbl ampex.table.align='center'?><?ctbl ampex.colwidth='100'?>
<colspec align="left" colname="col1" colnum="1"/><?ctbl ampex.vert.just='top'?><?ctbl ampex.colwidth='100'?>
<colspec align="center" colname="col2" colnum="2"/><?ctbl ampex.vert.just='top'?>
<tbody>
<row>
<entry colname="col1" valign="top">
<para>
<paratext ID="p69">
<leader source="dtbl">
<leaderchar>1</leaderchar>
</leader>
</paratext>
</para>
</entry>
<entry colname="col2" valign="top">
<para>
<paratext ID="p70"/>
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</tbl>
my cursor position is inside entry tag
Please find below table structure.
<tbl ID="tbl5" maxsize="default">
<table colsep="0" rowsep="0"><?ctbl ampex.cols='2'?>
<tgroup cols="2"><?ctbl ampex.table.align='center'?><?ctbl ampex.colwidth='100'?>
<colspec align="left" colname="col1" colnum="1"/><?ctbl ampex.vert.just='top'?><?ctbl ampex.colwidth='100'?>
<colspec align="center" colname="col2" colnum="2"/><?ctbl ampex.vert.just='top'?>
<tbody>
<row>
<entry colname="col1" valign="top">
<para>
<paratext ID="p69">
<leader source="dtbl">
<leaderchar>1</leaderchar>
</leader>
</paratext>
</para>
</entry>
<entry colname="col2" valign="top">
<para>
<paratext ID="p70"/>
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</tbl>
my cursor position is inside entry tag
Re: CALS Table functions
Hello,
Thank you for the sample and the details, we managed to reproduce the problem.
We analyzed this and the error appears when there are processing instructions inside the table, between the colspecs.
If I remove the processing instructions from your sample, the action works well.
We added an issue in our internal issues tracking system for this and we will update this thread when a fix will be available (the fix must be included in a Web Author release, it is not something that can be fixed in the CALS tables sample plugin).
Best Regards,
Mihaela
Thank you for the sample and the details, we managed to reproduce the problem.
We analyzed this and the error appears when there are processing instructions inside the table, between the colspecs.
If I remove the processing instructions from your sample, the action works well.
We added an issue in our internal issues tracking system for this and we will update this thread when a fix will be available (the fix must be included in a Web Author release, it is not something that can be fixed in the CALS tables sample plugin).
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: CALS Table functions
Hello,
It is ok for you that this problem to be fixed in the next Web Author version (25.1)? The release is planned in two months.
Best Regards,
Mihaela
It is ok for you that this problem to be fixed in the next Web Author version (25.1)? The release is planned in two months.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: CALS Table functions
Thank you Mihaela for the update.
Actually Next month we have prod release so we need to provide this item end of this month itself.
Now using insertXMLFragmentSchemaAware am able to insert new column.
For updating new column name and number to colspec using below code.
Below code giving CALSColSpec object as null.. Could you please tell me am i missing anything.
Thanks & Regards
Shilpa.P
Actually Next month we have prod release so we need to provide this item end of this month itself.
Now using insertXMLFragmentSchemaAware am able to insert new column.
For updating new column name and number to colspec using below code.
Below code giving CALSColSpec object as null.. Could you please tell me am i missing anything.
Code: Select all
int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
AuthorNode nodeAtCaret = docCtrl.getNodeAtOffset(caretOffset);
cellElement = getElementAncestor(nodeAtCaret, AuthorTableHelper.TYPE_CELL);
if(null!=cellElement) {
AuthorElement tgroupElement = getElementAncestor(nodeAtCaret, AuthorTableHelper.TYPE_TABLE);
List<AuthorNode> childNodes = tgroupElement.getContentNodes();
AuthorElement tableElement = (AuthorElement) tgroupElement.getParentElement();
AuthorTableCellSpanProvider provider = tableHelper.getTableCellSpanProvider(tableElement);
CALSTableCellInfoProvider cellInfoProvider = new CALSTableCellInfoProvider(true);
cellInfoProvider.init(tableElement);
for(AuthorNode childNode : tgroupElement.getContentNodes()) {
if(childNode.getType() == AuthorNode.NODE_TYPE_ELEMENT && tableHelper.isColspec(childNode)){
AuthorElement childElement = (AuthorElement) childNode;
String colSpecName = childElement.getAttribute("colname").getValue();
CALSColSpec calsColSpec = cellInfoProvider.getColSpec(colSpecName);
}
}
}
Shilpa.P
-
- Site Admin
- Posts: 163
- Joined: Tue Mar 20, 2018 5:28 pm
Re: CALS Table functions
Post by Bogdan Dumitru »
Hello Shilpa,
The "calsColSpec" variable might be null if the AuthorTableCellSpanProvider is created on the wrong element (tableHelper.getTableCellSpanProvider(tableElement)). The "getTableCellSpanProvider" method should be called with the parameter that has the "display: table" CSS property specified. Notice that for the CALS tables, the "display: table" CSS property is set on the "tgroup" element, not on the "table" element. Try replacing "getTableCellSpanProvider(tableElement)" with "getTableCellSpanProvider(tgroupElement)".
The "calsColSpec" variable might be null if the AuthorTableCellSpanProvider is created on the wrong element (tableHelper.getTableCellSpanProvider(tableElement)). The "getTableCellSpanProvider" method should be called with the parameter that has the "display: table" CSS property specified. Notice that for the CALS tables, the "display: table" CSS property is set on the "tgroup" element, not on the "table" element. Try replacing "getTableCellSpanProvider(tableElement)" with "getTableCellSpanProvider(tgroupElement)".
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: CALS Table functions
Thanks Dumitru..
Now i am able to get CALSColSpec object.
Below is my table structure
My requirement is to add new column to each rows of existing table.
Below is the code to add a new column.
docCtrl.insertXMLFragmentSchemaAware(cellFragment. offsetToInsert);
//Below code for getting existing colspec
AuthorTableCellSpanProvider tableCellsSpanprovider = tableHelper.getTableCellSpanProvider(tgroupElement);
CALSTableCellInfoProvider cellInfoProvider = new CALSTableCellInfoProvider(true);
cellInfoProvider.init(tgroupElement);
CALSColSpec calsColSpec= cellInfoProvider.getColSpec(cellColSpecName);
int colIndex = calsColSpec.getIndexInDocument();
//count is number of colspec already present in table
after column insertion i am adding below code to update colspec
updateColumnCellsSpan(authorAccess, tableCellsSpanprovider, tgroupElement, colIndex,
new TableColumnSpecificationInformation(WidthRepresentation.DEFAULT_WIDTH_REPRESENTATION),
"http://www.thomsonreuters.com/legal/judicialdocs", count);
Getting below exception
ro.sync.ecss.extensions.api.AuthorOperationException: Could not compute the index of the column to be inserted.
Please let me know if anything wrong i am doing for updating the colspec.
Now i am able to get CALSColSpec object.
Below is my table structure
- image.png (56.36 KiB) Viewed 1513 times
Below is the code to add a new column.
docCtrl.insertXMLFragmentSchemaAware(cellFragment. offsetToInsert);
//Below code for getting existing colspec
AuthorTableCellSpanProvider tableCellsSpanprovider = tableHelper.getTableCellSpanProvider(tgroupElement);
CALSTableCellInfoProvider cellInfoProvider = new CALSTableCellInfoProvider(true);
cellInfoProvider.init(tgroupElement);
CALSColSpec calsColSpec= cellInfoProvider.getColSpec(cellColSpecName);
int colIndex = calsColSpec.getIndexInDocument();
//count is number of colspec already present in table
after column insertion i am adding below code to update colspec
updateColumnCellsSpan(authorAccess, tableCellsSpanprovider, tgroupElement, colIndex,
new TableColumnSpecificationInformation(WidthRepresentation.DEFAULT_WIDTH_REPRESENTATION),
"http://www.thomsonreuters.com/legal/judicialdocs", count);
Getting below exception
ro.sync.ecss.extensions.api.AuthorOperationException: Could not compute the index of the column to be inserted.
Please let me know if anything wrong i am doing for updating the colspec.
Re: CALS Table functions
Hello,
From what I understand you are trying to implement the Insert Column operation because the built-in operation fails with "Could not compute the index of the column to be inserted" error when there are processing instructions in the colspecs.
We analyzed the code to find the source of the error and here is what you can do: you can copy the code from the built-in operation (ro.sync.ecss.extensions.commons.table.operations.cals.InsertColumnOperation) and apply the next fix: move the incrementation of i from line 189 inside the preceding if.
So, the code is:
and you must correct it like this:
This code tries to determine the index of a colspec and the problem is that the index is incremented even when the processing instruction is encountered.
Please let us know if this fix works for you.
We will also include the fix in the next release of Web Author and we will update this thread when it will be available so that you can use the built-in operation instead of this temporary solution.
Best Regards,
Mihaela
From what I understand you are trying to implement the Insert Column operation because the built-in operation fails with "Could not compute the index of the column to be inserted" error when there are processing instructions in the colspecs.
We analyzed the code to find the source of the error and here is what you can do: you can copy the code from the built-in operation (ro.sync.ecss.extensions.commons.table.operations.cals.InsertColumnOperation) and apply the next fix: move the incrementation of i from line 189 inside the preceding if.
So, the code is:
- image.png (39.83 KiB) Viewed 1468 times
- image.png (53.21 KiB) Viewed 1468 times
Please let us know if this fix works for you.
We will also include the fix in the next release of Web Author and we will update this thread when it will be available so that you can use the built-in operation instead of this temporary solution.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service