// Adds child parts and generates content of the specified part. private void CreateParts(WordprocessingDocument document) { ExtendedPart extendedPart1 = document.AddExtendedPart("http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties", "application/vnd.openxmlformats-package.core-properties+xml", "xml", "rId1"); GenerateExtendedPart1Content(extendedPart1); ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId2"); GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1); MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart(); GenerateMainDocumentPart1Content(mainDocumentPart1); StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1"); GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1); FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId2"); GenerateFontTablePart1Content(fontTablePart1); DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3"); GenerateDocumentSettingsPart1Content(documentSettingsPart1); TableRow tet = GenTab(); // mainDocumentPart1.Document.Body.ChildElements.GetItem(1).Append(tet); mainDocumentPart1.Document.Body.ChildElements.GetItem(1).InsertAt(tet, 50); SetPackageProperties(document); }