Copy link to clipboard
Copied
How can get child Items of Cell?
This is my code getting cell content and access inline object of Cell.
But If i get sourceStory , this return story of parent textframe:
// get the grid address of cell
GridAddress gridAddress = *iterTable;
InterfacePtr<ITextStoryThreadDict> textStoryThreadDict(tableModel, UseDefaultIID());
ASSERT(textStoryThreadDict);
GridID targetCellGridID = tableModel->GetGridID(gridAddress);
InterfacePtr<ITextStoryThread> textStoryThread(textStoryThreadDict->QueryThread(targetCellGridID));
InterfacePtr<ITextModel> textModel(textStoryThread->QueryTextModel());
int32 span = (-1);
TextIndex at = textStoryThread->GetTextStart(&span);
TextIterator beginTextChunk(textModel, at);
TextIterator endTextChunk(textModel, at + span - 1);
//Get Inline Cell
UIDRef sourceStory = ::GetUIDRef(textModel);
InspectStoryInlines(sourceStory);
Copy link to clipboard
Copied
Not too sure on this one? Maybe @Laubender or @Peter Kahrel can be of assistance?
Copy link to clipboard
Copied
Hi Eugene,
I'm of no big help here. That's code for plug-in programming and not for ExtendScript scripting.
But I assume that there could be a similar architecture. At least with the issue what could work with "sourceStory".
In ExtendScript we have the same.
The parentStory of a table cell is the story that contains the table.
The parent of a table cell is the table itself.
But this is not asked, the contents of a table cell is asked, I guess.
And for this we have two cases.
[1] Either the cell is a graphic cell then it would contain no texts object directly.
cell.texts.length == 0
[2] The other case, the contents is a Texts object.
cell.texts.length == 1
And that Texts object could contain formatted text of course, but also anchored objects, Note objects etc.pp.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Yes, In Script: Cell has attributes: tables, pageItems
In SDK Plugin , Can it get?
Copy link to clipboard
Copied
Thanks for that - I didn't know who else to ask.
Copy link to clipboard
Copied
Hi, can i ask about script writing training in indesign?? can you?
Copy link to clipboard
Copied
Also in ExtendScript terms:
The parentStory of cell.texts is the story that contains the table.
The parent of cell.texts is the cell.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Can't get inline objects of Cells?
I had find sample of sdk, but not found anything.
Copy link to clipboard
Copied
With ExtendScript you can get all that.
cell.allPageItems
for example will get a frame and a graphic if the user placed an image in a graphic cell.
Or it will get all anchored frames with all their nested items if you have a text cell where e.g. a group of objects is anchored.
There should also be something like allPageItems or allGraphics in the SDK.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Are you eventually talking about "Convert Cell to Graphics Cell"?
There might be better / faster ways, facades, what do you know, I haven't really looked into it. Currently fighting fonts. But given that you already mention having a gridAddress …
Cell content is buried in the cell strand, but you should get there straight from IID_ITABLEMODEL.
Given your gridAddres, the call is QueryCellContentBoss(gridAddress).
You'll have a kPageItemCellContentBoss IID_ICELLCONTENT, see the item list.
For graphics cell that is a separate page item hierarchy, root is
kCellPageItemAdapterBoss IID_IHIERARCHY holding a
kSplineItemBoss, again IID_IHIERARCHY that finally gives you
kImageItem
Inlines placed into regular table cell text should work just like with regular text outside tables, check your example that it is really one of them.
If you are just looking for the text contents of a table cell, kTextCellContentBoss also has an IID_ITEXTSTORYTHREAD where the offsets look better to me.
Does that get you closer?