Hi,
I have a tagged graphic frame and am trying to replace the image without loosing the link to the tag.....
I have tried using the Hierachy to remove the image which works - But I loose the link to the tag:
InterfacePtr<IGraphicFrameData> graphicFrame(ref, UseDefaultIID());
InterfacePtr<IHierarchy> graphicFrameHierarchy(graphicFrame, UseDefaultIID());
InterfacePtr<IHierarchy> childHierarchy(graphicFrameHierarchy->QueryChild(0));
graphicFrameHierarchy->Remove(childHierarchy);
I have managed to do something in Extended Script which has worked using links.
var vLinks = myDoc.links;
var link = vLinks.itemByName("Hydrangeas.jpg");
link.relink(new File("C:/Users/Public/Pictures/Sample Pictures/Koala.jpg"));
Any Ideas?
Thanks
Nathan Deamer
*I have also tried retagging the image after deleting and replacing the graphic. But due to how it is set up I can't tag the frame when it is in a group inside a text frame.....
Thank you ![]()
Here is parts of the code I used which will hopefully help anyone else:
UIDRef ref; //Set this
IDFile file; //Set this
URI uri;
Utils<IURIUtils>()->IDFileToURI(file, uri);
//Use the ILinkFacade to relink to the uri.
InterfacePtr<IHierarchy> graphicFrameHierarchy(ref, UseDefaultIID());
InterfacePtr<IHierarchy> childHierarchy(graphicFrameHierarchy->QueryChild(0));
InterfacePtr<ILinkObject> iLinkObject(childHierarchy,UseDefaultIID());
IDataBase* iDataBase = ::GetDataBase(childHierarchy);
InterfacePtr<ILinkManager> iLinkManager(iDataBase,iDataBase->GetRootUID(),UseDefaultIID());
ILinkManager::QueryResult linkQueryResult;
UIDList linkList(iDataBase);
if (iLinkManager->QueryLinksByObjectUID(::GetUID(childHierarchy), linkList)){
UID linkUID = linkList.At(0);
UIDRef linkUIDRef(iDataBase, linkUID);
Utils<Facade::ILinkFacade>()->RelinkLink(linkUIDRef, uri, K2::kSuppressUI, linkUID);
}
North America
Europe, Middle East and Africa
Asia Pacific