sendreams:the diff is: the toc insert by word is hosting in a ContentControl, but this ContentControl has disappeared when use aspose api.however if i use almost same code to insert a cover page will be ok. all ContentControl has reserved.can you please check it?
sendreams:and then, there is another unexpected exception, in here if use DocumentBuilder api, the insert operation will throw an exception.please look below picture.unexpected exceptionmaybe a bug. please check it.
Document docBuildingBlocks = new Document(@"C:\Built-In Building Blocks.dotx");
Document docx = new Document(MyDir + "test.docx");
Aspose.Words.BuildingBlocks.GlossaryDocument glossaryDocument = docBuildingBlocks.GlossaryDocument;
foreach (Aspose.Words.BuildingBlocks.BuildingBlock buildingBlock in glossaryDocument.BuildingBlocks)
if (buildingBlock.Name == "Whisp")
Section sec = (Section)buildingBlock.FirstChild;
docx.InsertBefore(docx.ImportNode(sec, true), docx.FirstChild);