It's all about the answers!

Ask a question

How to Generate RPE report (with IBM RDNG data source) with table caption being printed in center


Prashanth Manohar Gopi (157) | asked Mar 11 '21, 11:38 p.m.

 Hi All,


When I create a table in DNG and add table caption, in the RPE Generated report we are getting table caption at the leftmost side after table.

I wanted to know how to align table caption in RPE template


3 answers



permanent link
Subramanya Prasad Pilar (4.6k15) | answered Mar 12 '21, 11:39 a.m.
edited Mar 25 '21, 7:07 a.m.

The workaround provided by Bartosz is good. You can find the modified template UAS-Functional-SPP.dta that will center-align the table captions.
You can also try the macro solution (works only for Word output and not for PDF output).


Comments
Bartosz Chrabski commented Mar 12 '21, 2:31 p.m.
Subramanya,

You are wrong because you will be able to generate list of tables using this workaround. If You will read the code carefull it is talking <caption></caption> outside the table and encapsulate this in centered span.

This will still generate properly working ToT. You can check this by yourself or I can provide working example.

Subramanya Prasad Pilar commented Mar 13 '21, 12:12 a.m.

Good to know that. Sorry, I should have checked it before commenting. :)


Prashanth Manohar Gopi commented Mar 18 '21, 11:25 p.m.

Hi Bartosz,


I tried doing it the workaround it did not work, can you please provide working sample

Regards,
Prashanth  


Prashanth Manohar Gopi commented Mar 25 '21, 5:06 a.m.

 Hi Bartosz,


I tried doing it the workaround it did not work, can you please provide working sample or please provide the work instructions to implement it in RPE template

Regards,
Prashanth  


Subramanya Prasad Pilar commented Mar 30 '21, 9:58 a.m.
You should return div, else Script Expression will retun undefined value.

var match = {};
var patt = /(<table[^>]*>(<caption[^>]*>(?:.|\n)*?<\/caption>)?(?:.|\n)*?<\/table>)/g;
while (match = patt.exec(div)) {
  var table = match[1];
  var caption = match[2];
  if (caption)
  {
  table = table.replace(caption, "");
  table = '<div  style="text-align:center;"><span>'+caption+"</span></div>" + table;
  div = div.replace(match[1], table);
}
}
div;

permanent link
Subramanya Prasad Pilar (4.6k15) | answered Mar 12 '21, 4:11 a.m.
Hi Prashant,
This is a limitation as of now, you can find the details in

Comments
Prashanth Manohar Gopi commented Mar 12 '21, 4:50 a.m.

How to implement the workaround that is suggested in discussion section in work item??

Kindly let me know the procedure how to implement the workaround
 


permanent link
Bartosz Chrabski (3.4k12648) | answered Mar 12 '21, 4:57 a.m.

As a author of the workaround in the ticket I think I should answer this.

For the text element that is displaying the text you should add following code.

var match = {};
var patt = /(<table[^>]>(<caption[^>]>(?:.|\n)?<\/caption>)?(?:.|\n)?<\/table>)/g;
while ((match = patt.exec(div))) {
  var table = match[1];
  var caption = match[2];
  if (caption)
  {
  table = table.replace(caption, "");
  table = '<div  style="text-align:center;"><span>Table '+caption+"</span></div>" + table;
  div = div.replace(match[1], table);
}
}

This code is moving <caption> to span outside of the table (before it). That is only way how I was able to implement it.

Prashant mentioned the ticket which was requested opened by me

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.