如何为多个PDF表重命名列你好呀,
我编写了一个脚本,使我能够从多个pdf文件中提取表格。 将打开每个表,并且表名与文件名匹配。
我已经意识到pdf的格式并不总是一致的,因此第3列的标题可以不同。 因此,我想将一个函数合并到我的脚本中,该函数将所有表的第3列重命名为“ Property”。 我已经尝试过Set Name()函数,但是它不起作用。 也许在错误的地方?
// Prepare a directory
tempdir = "C:\folder path";
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
Insert Into( table_lst, Open( tempdir || "/" || file_lst[i],
PDF Tables(
Table(
table name(file_lst[i]),
add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ),
column(table_lst[i],3) << set name("Property")
)
)
)
)
)任何帮助,将不胜感激!
数据表脚本编写回复:如何重命名多个PDF表的列我相信您对代码的以下修改将正确重命名该列
// Prepare a directory
tempdir = "C:\folder path";
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
dt = Open(
tempdir || "/" || file_lst[i],
PDF Tables(
Table( table name( file_lst[i] ), add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ) )
)
);
Column( table_lst[i], 3 ) << set name( "Property" );
);回复:如何重命名多个PDF表的列非常感谢您的回复@txnelson 。 不幸的是,运行脚本时,我收到了以下JMP警报:

回复:如何重命名多个PDF表的列你好,
Column( table_lst[i], 3 ) << set name( "Property" );
在“ for”循环之外。
如果将其复制/粘贴到循环中,则应该可以正常工作。
回复:如何重命名多个PDF表的列平衡的寄生虫至关重要
我非常喜欢选项“重新格式化脚本”(->编辑菜单,或crtl-m)来测试正确的语法。
回复:如何重命名多个PDF表的列非常感谢您的帮助!
我已经更新了我的脚本,如下所示,它可以工作,但是在打开所有表之后,将再次出现相同的JMP Alert。
有什么建议么?
Names Default To Here( 1 );
// Prepare a directory
tempdir = "C:\filepath;
// Read PDF's
file_lst = Files In Directory( tempdir );
table_lst = {};
For( i = 1, i <= N Items( file_lst ), i++,
Insert Into(
table_lst,
Open(
tempdir || "/" || file_lst[i],
PDF Tables( Table( table name( file_lst[i] ), add rows( page( 1 ), Rect( 0.4143, 5.3995, 7.5889, 6.6781 ) ) ) )
)
);
Column( table_lst[i], 3 ) << set name( "Property" );
)