Copy link to clipboard
Copied
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.
{
Thank you for your help.
1 Correct answer
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
worked with "if(cell.FirstPfg.Name === "zCell-PN")"
thank you! thank you!
Copy link to clipboard
Copied
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!

