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

Script not working, now that table header row is one, not two rows.

Explorer ,
Oct 18, 2021 Oct 18, 2021

I updated an old template, with an old script. To make it more effienct (constant cut and paste) I removed a header row and programmed the new header with Paragraph Formatting. Now the script no longer works.

If I read this correctly, the script identifies the table as a "Parts Table" and then runs the "Remove Rulings" script, and then runs the "Add Rulings" script, placing lines where they need to be. But it is broken, because it is not identifing the tables as a parts table or does not find the text "Part".

// script in question:

function main() //Removes ruling and adds
{
for (var q =0; q < textItems.len; q++)
{
table = textItems[q].obj;
table.HFSeparatorRuling = blargName2;
table.HFRowRuling = blargName2;
row = table.FirstRowInTbl;
if (row.ObjectValid())
{
topRowCell = row.FirstCellInRow;
cell = topRowCell;
cell = cell.CellBelowInCol;
cell = cell.NextCellInRow;
if(cell.ObjectValid())
{
blarg = cell.GetText(Constants.FTI_String);
dude = ""
if(blarg.len > 0)
{
dude = blarg[0].sdata;
}
if(dude.indexOf("PART") !== -1) //Checks for a Parts Table.
{

OldNewTable.pngexpand image

Thank you for your help.

274
Translate
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

correct answers 1 Correct answer

Mentor , Oct 19, 2021 Oct 19, 2021

That spelling of "FirstPfg" is wrong. I assume that was not a copy/paste from your code.

 

Happy to help. If the question has been answered to your satisfaction, please mark it as Answered. Thanks!

Translate
Mentor ,
Oct 19, 2021 Oct 19, 2021

Well dude, I don't fully understand what you are trying to do. But given what you did say, this line looks suspicious to me:

 

cell = cell.CellBelowInCol;

 

That seems like the line that was intended to step from the first header row to the second. Maybe comment out that line and try again. Might be what is blarging it up.

 

Russ

Translate
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 ,
Oct 19, 2021 Oct 19, 2021

Yes, that worked, Thank you.

Now I need to change the "cell.GetText(Constants.FTI_Sting);

   to identify a Paragraph Format instead of Text.

I programmed the table, so I don't have to copy and paste each table in the doc.

Thank you.

 

Translate
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 ,
Oct 19, 2021 Oct 19, 2021

OK. So maybe try this (untested obviously, just a quick guess).

 

Replace all of this:

 

{
blarg = cell.GetText(Constants.FTI_String);
dude = ""
if(blarg.len > 0)
{
dude = blarg[0].sdata;
}
if(dude.indexOf("PART") !== -1) //Checks for a Parts Table.
{

 

...with this:

{
  if(cell.FirstPgf.Name == "zCell-PN")
  {

 

Russ

Translate
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 ,
Oct 19, 2021 Oct 19, 2021

worked with  "if(cell.FirstPfg.Name === "zCell-PN")"

thank you! thank you!

Translate
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 ,
Oct 19, 2021 Oct 19, 2021
LATEST

That spelling of "FirstPfg" is wrong. I assume that was not a copy/paste from your code.

 

Happy to help. If the question has been answered to your satisfaction, please mark it as Answered. Thanks!

Translate
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