如何使用扩展脚本在InDesign CS6中设置Excel导入首选项? [英] How to set Excel Import Preferences in InDesign CS6 using extendscript?

查看:194
本文介绍了如何使用扩展脚本在InDesign CS6中设置Excel导入首选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎应该非常简单,但是由于某种原因,我根本无法使用它。以下代码完全无效:

This seems like it should be really simple, but for some reason I can't get it to work at all. The following code has no effect whatsoever:

function setExcelImportPrefs() {  
  with(app.excelImportPreferences){
    rangeName = "A1:Z300";
    sheetName = "whatever";
    tableFormatting = TableFormattingOptions.excelFormattedTable;
  }
}

而且这也不起作用:

function setExcelImportPrefs() {  
  with(app.excelImportPreferences){
    app.excelImportPreferences.rangeName = "A1:Z300";
    app.excelImportPreferences.sheetName = "whatever";
    app.excelImportPreferences.tableFormatting = TableFormattingOptions.excelFormattedTable;
  }
}

我在做什么错?我已经用Google搜寻了所有内容,而且机智尽收。 (注意:我有InDesign CS6,版本8.0)

What am I doing wrong? I've Googled everything, and I'm at my wits end. (Note: I have InDesign CS6, version 8.0)

编辑:放入一个在粘贴和粘贴时不小心遗漏的括号。

Put in a bracket that I accidentally left out when I was copying-and-pasting.

推荐答案

我对这些设置不熟悉,但是您似乎缺少了括号。只需一起摆脱with语法,然后尝试

I'm not familiar with these settings, but you seem to have be missing a bracket. Just get rid of the with syntax all together and try

function setExcelImportPrefs() {    
  app.excelImportPreferences.rangeName = "A1:Z300";
  app.excelImportPreferences.sheetName = "whatever";
  app.excelImportPreferences.tableFormatting = TableFormattingOptions.excelFormattedTable;
}

这篇关于如何使用扩展脚本在InDesign CS6中设置Excel导入首选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆