Skip to main content
Known Participant
June 16, 2013
Answered

Microsoft excel import settings.

  • June 16, 2013
  • 1 reply
  • 924 views

Hi Forum,

I need a help to select "Show Import Options" while placing excel files using Script.

and then setting:

tableFormatting = TableFormattingOptions.excelFormattedTable;

I can't find the reference for the above anywhere,

Icant find the settings changed in Place option settings, when I use the below code.

with(app.excelImportPreferences){

tableFormatting = TableFormattingOptions.excelFormattedTable;

}

Please help to do this.

thanks

Dhinak.

This topic has been closed for replies.
Correct answer booyajamo

Hi Dhinak,

The documentation for properties/methods can be found here

http://jongware.mit.edu/idcs6js/

You can search for other versions of CS documentation if you are not using CS6.

Here is an example of how you can set the properties that you see when you check "show import options" from the user interface:

var doc = app.activeDocument;

var excelPrefs = app.excelImportPreferences;

excelPrefs.tableFormatting = TableFormattingOptions.EXCEL_FORMATTED_TABLE;

var frame = doc.rectangles.add ({geometricBounds: [1,1,10,7.5]});

frame.place (File ("~/Desktop/test.xlsx"), false);

Lindsay

1 reply

booyajamoCorrect answer
Inspiring
June 17, 2013

Hi Dhinak,

The documentation for properties/methods can be found here

http://jongware.mit.edu/idcs6js/

You can search for other versions of CS documentation if you are not using CS6.

Here is an example of how you can set the properties that you see when you check "show import options" from the user interface:

var doc = app.activeDocument;

var excelPrefs = app.excelImportPreferences;

excelPrefs.tableFormatting = TableFormattingOptions.EXCEL_FORMATTED_TABLE;

var frame = doc.rectangles.add ({geometricBounds: [1,1,10,7.5]});

frame.place (File ("~/Desktop/test.xlsx"), false);

Lindsay

Wander5Author
Known Participant
June 17, 2013

Hi Lindsay,

Thanks for the response.

I search the link, and it seems there is not option so select "Show Import Options".

However, you script really help me in other ways.

thanks & rgs,

Dhinak.

Inspiring
June 18, 2013

Hi Dhinak,

Glad the code helped you.

If you want to set the import options without the user's input just set the properties using the excelImportPreferences.

If you want the dialog to open so the user can select the import options change the false to true in the frame.place() line of code.

Hope this helps,

Lindsay