foreach (BuildingBlock buildingBlock in glossaryDocument.BuildingBlocks)
{
if (buildingBlock.Gallery.ToString().StartsWith("CoverPage"))
{
// clone section which you want to keep layout of
Section sec = docCopyOut.FirstSection.Clone();
// remove existing content of this section
sec.RemoveAllChildren();
// append content of buildingBlock to this section
foreach (Node node in ((Section)buildingBlock.FirstChild).ChildNodes)
sec.AppendChild(docCopyOut.ImportNode(node, true));
docCopyOut.AppendChild(sec);
break;
}
}
hi, Tahir
The issues you have found earlier (filed as WORDSNET-9941) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
hi, Tahir
i use the latest 14.4
hi, Tahir
for your patience. Please use the following code example to import Building Blocks from one document to another. Hope this helps you. Please let us know if you have any more queries.
Document doc = new Document();
doc.GlossaryDocument = new GlossaryDocument();
doc.GlossaryDocument.BuildingBlocks.Add(new BuildingBlock(doc.GlossaryDocument));
var docCopyOut = new Document(MyDir + @"Built-In Building Blocks.dotx");
GlossaryDocument glossaryDocument = docCopyOut.GlossaryDocument;
foreach (BuildingBlock buildingBlock in glossaryDocument.BuildingBlocks)
{
if (buildingBlock.Gallery.ToString().StartsWith("CoverPage") && buildingBlock.Name == "Cubicles")
{
Node node = doc.GlossaryDocument.ImportNode(buildingBlock.FirstChild, true);
doc.GlossaryDocument.FirstBuildingBlock.Name = "AsposeWords";
doc.GlossaryDocument.FirstBuildingBlock.Category = "AsposeWords";
doc.GlossaryDocument.FirstBuildingBlock.ChildNodes.Add(node);
break;
}
}
doc.Save(MyDir + @"out.dotx");
hi, Tahir
for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.