Copy link to clipboard
Copied
Hi all,
I have a script for drag, drop and fitting a table. When a normal table is dragged and dropped it fits without any issues. But when I try to drag drop tables of sub-divided rows and columns (super and pivot tables) am getting the following error:
Error String : The property is not applicable in the current state.
Error Line:startPt = mySel.tables
I have mentioned below the script:
//Get the Cell Widths
var cellWidth = new Array(mySel.tables
for( var i = 0; i< mySel.tables
{
if(mySel.tables
{
if(mySel.tables
{
var newWidth;
var startPt,endPt;
newWidth = mySel.tables
mySel.tables
try{
startPt = mySel.tables
endPt = mySel.tables
}
catch(errCode){startPt=0;endPt=0;}
var len = endPt - startPt;
newWidth = newWidth+ len;
cellWidth = newWidth;
}
}
}
//Fit header Column First
for( var i = 0; i< mySel.tables
{
if(mySel.tables
{
if(mySel.tables
{
var newWidth;
var startPt,endPt;
newWidth = mySel.tables
startPt = mySel.tables
//this line shows error
endPt = mySel.tables
var len = endPt - startPt;
newWidth = newWidth+ len;
//mySel.tables
if(mySel.tables
{
newWidth=newWidth*100;
mySel.tables
}
else if(mySel.tables
{
// newWidth=newWidth*10;
mySel.tables
}
}
}
}
Thanks and Regards,
Revathi V
Copy link to clipboard
Copied
Check
$.writeln( mySel.isValid);
$.writeln( mySel.tables
$.writeln( mySel.tables
$.writeln( mySel.tables
$.writeln( mySel.tables
$.writeln( mySel.tables
Then you will see who is guilty here.
If you use the ESTK, simply use $.bp(); then investigate in the data panel
Copy link to clipboard
Copied
Hi Aigon and Uwe,
Thanks for your response.
The error has been fixed.But facing another error.
I have written my script as:
//Fit header Column First
.
.
.
.
var newWidth;
var startPt,endPt;
newWidth = mySel.tables
// startPt = mySel.tables
// endPt = mySel.tables
try {
startPt = table.cells.insertionPoints[0].texts[0].horizontalOffset;
endPt = table.cells.insertionPoints[table.cells.insertionPoints.count() - 1].texts[table.cells.texts.length - 1].endHorizontalOffset;
}
catch (errCode) { startPt = 0; endPt = 0; }// I have modified this part
.
.
.
.
}
}
}
Now I am able to fit tables without any error.When I am trying to fit a table with image I am able to fit it without any error for a normal table.When I am trying to fit a table with sub-divided rows and columns and with images ,Iam getting the following error:
Error String:Invalid width for set property width.Expected unit,but received "135"
Error Line: mySel.tables
function FitTable (mySel)
{
mySel.recompose();
for( var j = 0; j< mySel.tables.length ; j++ )
{
var table = mySel.tables
for( var i = 0; i< mySel.tables
{
if (mySel.tables
table.columns.width = mySel.tables
}
else {
table.columns.width = mySel.tables
}
}
Regards,
Revathi V
Copy link to clipboard
Copied
Hi Revathi,
you want to get access to the value of horizontalOffset of the first insertion point in a cell.
This value is only available if the insertion point in the cell can show.
So "The property is not applicable in the current state." could mean that the cell is overset and property overflow returns true.
Here a case where the insertion point cannot show, because the cell is of fixed height and the point size of the text is too large.
From my German InDesign also showing the Story Editor window. "Ãœbersatz" means "overflow" or "overset".
If I run the following snippet on that selection my German InDesign will answer with a German version of your error message:
"Diese Eigenschaft ist im aktuellen Status nicht zutreffend."
try{
app.selection[0].tables[0].cells[1].insertionPoints[0].horizontalOffset
}catch(e)
{
alert(e.message);
$.writeln(e.message);
};
Maybe at first glance you will not see the "red dot" in the cell showing the cell overflows, because the contents is empty?
Like that:
Note: The end of story marker is also missing in the cell.
Because you cannot see the end of the story. And the culprit here is an insertion point that is formatted with 32 pt and cell is of fixed height.
Also look for other formatting in your table cell that would force overset cells.
Regards,
Uwe