We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copy foot notes from one document to another

Hi,


We have a requirement where we will have to copy the content of one rich text editor to another rich text editor in another document. For that we are extracting the content of the rich text control into a html list and storing it at a place and when needed we are getting that back and inserting it back into the new document. When we do this, the foot notes are not getting extracted. Is there a way to extract those foot notes too and insert them exactly in the same position in the new document.

Could you please provide a solution with a code snippet.

Attached the document and extraction code:

NodeCollection nodeCol= inputDocument.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG,true);
for (StructuredDocumentTag node : (Iterable)nodeCol) {
String name=node.getTag();
depFieldsMap.put(name, node.toString(SaveFormat.HTML));
}


Regards,
Rajesh.

Hi Rajesh,


Thanks for your inquiry. When you do a Word to Html to Word round-trip using the node.toString(SaveFormat.HTML) way, it is not guaranteed that all elements will remain be preserved. We suggest you please import the target SDT into a new empty document and save this document (or its Html representation if it is really the needed format) containing just the SDT for future use.

Document doc = new Document(getMyDir() + “sample.docx”);
Document temp = new Document();

for (StructuredDocumentTag sdt : (Iterable) doc.getChildNodes
(NodeType.STRUCTURED_DOCUMENT_TAG, true))
{
temp.getFirstSection().getBody().appendChild
(temp.importNode(sdt, true, ImportFormatMode.KEEP_SOURCE_FORMATTING));
}

temp.save(getMyDir() + “awjava-16.3.0.html”);

Hope, this helps.

Best regards,