Page 1 of 1

Clone Content from one CoreDoc page to another

Posted: Tue Apr 27, 2021 2:12 pm
by zarkogajic
Hi Support,

What's wrong with the below code - why is the resulting page newDoc's empty:

Code: Select all

//pseduo
IPXC_Content pContent = CoreDoc.Pages[0].GetContent(CAccessMode_FullClone);

//not sure if needed, but no changes in resulting page: 
//IPXC_Content pContentClone = pContent.Clone(false)

CoreDoc.Pages[0].Get_Box(PBox_MediaBox, stMediaBox)

newDoc = IPXC_Inst.NewDocument

newDoc.Pages.AddEmptyPages(0, 1, stMediaBox, nil, pUndoData);

newDoc.Pages[0].PlaceContent(pContent[Clone], PlaceContent_After);

newDoc.WriteToFile(...)
The resulting "newDoc" has one page but it is empty.

The pContent (content from 1st page of CoreDoc) does have items (so not empty).

What am I missing?

-žarko

Re: Clone Content from one CoreDoc page to another

Posted: Wed Apr 28, 2021 6:20 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

The thing is that you cannot just simply copy contents between documents. This can be done only with the container that the content resides in. To put it simpler - you will need to copy a needed page to the needed document, copy the content from it and then remove the page.

Cheers,
Alex

Re: Clone Content from one CoreDoc page to another

Posted: Wed Apr 28, 2021 8:28 am
by zarkogajic
Hi Alex,

ok, thanks.
you will need to copy a needed page to the needed document
Any other way than InsertPagesFromDoc ?




-žarko

Re: Clone Content from one CoreDoc page to another

Posted: Wed Apr 28, 2021 10:50 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

I'm afraid that you will have to cope with that one.

Cheers,
Alex

Re: Clone Content from one CoreDoc page to another  SOLVED

Posted: Wed Apr 28, 2021 11:02 am
by zarkogajic
Hi Alex,

Ok, noted, thanks.


Clone Content from one CoreDoc page to another

Posted: Wed Apr 28, 2021 11:05 am
by Sasha - Tracker Dev Team
:)