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

How can detect link frame exist data of table?

Enthusiast ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

I have a long table put in 3 TextFrames as below image:

How can detect middle link frame exist data of table?

in 2 cases:  i try get content of link frame = emtpy.

tablelink.PNG

TOPICS
Scripting

Views

235

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

correct answers 1 Correct answer

Community Expert , Aug 04, 2021 Aug 04, 2021

Hi daitranthanhoa,

with table cells of type text you could access the first insertion point and ask for the parentTextFrames array.

If you then iterate through the cells you'll see that parentTextFrames[0] of the first insertionPoint will never be that empty text frame. In ExtendScript code:

 

Let's assume you selected a text frame.

 

( function()
{

var doesContainCells = "Text frame shows table cells.";
var doesNotContainCells = "Text frame shows NO table cells.";

var textFrame = app.selectio
...

Votes

Translate

Translate
Community Expert ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

Actually the contents of the middle link frame *is* empty.

The 2nd table did not fit in the middle frame so has jumped to frame 3.

The 3rd table is overset completely.

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
Enthusiast ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

How can detect middle link frame : can display and can't display data of table?

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 ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

If textframe.tables.length == 0?

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
Enthusiast ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

middle link frame : can display and can't display :

Both 2 cases:  textframe.tables.length = 0

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 ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

LATEST

No. That's not it.

Would only work for the first text frame of a story.

 

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
Community Expert ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

Hi daitranthanhoa,

with table cells of type text you could access the first insertion point and ask for the parentTextFrames array.

If you then iterate through the cells you'll see that parentTextFrames[0] of the first insertionPoint will never be that empty text frame. In ExtendScript code:

 

Let's assume you selected a text frame.

 

( function()
{

var doesContainCells = "Text frame shows table cells.";
var doesNotContainCells = "Text frame shows NO table cells.";

var textFrame = app.selection[0];
var story = textFrame.parentStory;

var tablesOfStory = story.tables;

if( tablesOfStory.length == 0 )
{
	alert( doesNotContainCells );
	return
};

var allCellsOfAllTables = story.tables.everyItem().cells.everyItem().getElements();
var allCellsOfAllTablesLength = allCellsOfAllTables.length;

for( var n=0; n<allCellsOfAllTablesLength; n++ )
{
	try
	{
		if( allCellsOfAllTables[n].insertionPoints[0].parentTextFrames[0] == textFrame )
		{
			alert( doesContainCells );
			return
		};
	}catch(e){};
};

alert( doesNotContainCells );

}() )

 

A warning!

[1] It will not work with graphic cells.

[2] It will not work with text cells of fixed height that have no contents and are "overset" means, the first insertion point is not visible.

[3] Perhaps other cases. Do your own tests and error logging!

 

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