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

Indesign script for alert the script is not running due to hidden column

Contributor ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

 Hi all

Is there any code to alert  the user for script is not running due to hidden rows/columns. 

TOPICS
Scripting

Views

377

Translate

Translate

Report

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
Community Expert ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

By hidden, do you mean overflows (red arrow or dot?) I think it depends on what operation is failing. If you know the error message that's being thrown, you could do: 

try {
  //some operation that fails on overset rows/columns
} catch(e) {
    if (e.indexOf("Thrown Error message phrase") { 
        alert("The table has overset rows or columns. Fix it and try again.");
        return;
    }
}

 

You could also leverage the 'overflows' property of a containing text frame, or for cells in a row or column:

if (aTableTextFrame.overflows) {
    alert("A table text frame overflows");
}

or 

if (aRow.overflows) {
    //same alert/quit message
}

Votes

Translate

Translate

Report

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
Community Expert ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

Hi Rocky,

it's unclear for me what you exactly want.

I understand you have a table with rows and columns.

Maybe placed from an Excel spreadsheet.

 

If you import an Excel spreadsheet that has hidden rows and columns you could check the option to import all hidden rows and columns in the Import Options dialog. This option is turned off by default. So by default hidden rows and columns will not be imported.

 

And now you need script code to make sure that this option is turned off?

With ExtendScript code this would be:

 

app.excelImportPreferences.showHiddenCells = false;

 

 

Or do you want to alert the user how this property is currently set?

That would be:

alert
(	
	"Show Hidden Cells when import a table is set to:"+"\r\r"+
	app.excelImportPreferences.showHiddenCells  
);

 

Note: After placing a table there is no feature in InDesign to hide rows or columns.

 

Regards,

Uwe Laubender

( ACP )

 

Votes

Translate

Translate

Report

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
Contributor ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

Thanks Laubender,

 

is there any common javascript code to find the hidden cells in the excel file (not through indesign API)? 

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

Not that I know.

If the Excel file is a *.xlsx file you might find a hint in the XML structure of the unzipped *.xlsx file.

On the other hand you could import the same Excel file two times with changing options and compare the number of columns and rows after import.

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

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
Contributor ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

LATEST

Thanks!

 

I have tried with below applescript but I can able to get the single sheet hidden rows and cloumns of active sheet in the excel file.

tell application "Microsoft Excel"
   
   repeat with i from 1 to (count of worksheets of active workbook)
       set theSheet to name of sheet i of active workbook
       tell (get used range of sheet i of active workbook)
           repeat with j from 1 to count rows
               if hidden of row j of used range of sheet i then
                   display dialog (theSheet & " " & "row " & j & " is hidden")
               end if
           end repeat
           repeat with k from 1 to count columns
               if hidden of column k of used range of sheet i then
                   display dialog (theSheet & " " & "column " & k & " is hidden")
               end if
           end repeat
       end tell
   end repeat
end tell

 

Could anyone help me to find the hidden rows and columns in the entire worksheet of excel files.

Votes

Translate

Translate

Report

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