- void AddStylesPart()
- {
- StyleDefinitionsPart styleDefinitionsPart = mainPart.StyleDefinitionsPart;
- styleDefinitionsPart = mainPart.AddNewPart<StyleDefinitionsPart>();
- Styles styles1 = new Styles();
- styles1.Save(styleDefinitionsPart);
- if (styleDefinitionsPart != null)
- {
- using (WordprocessingDocument wordTemplate = WordprocessingDocument.Open(@"..\AT\Docs\F4DEV.docx", false))
- {
- foreach (var templateStyle in wordTemplate.MainDocumentPart.StyleDefinitionsPart.Styles)
- {
- styleDefinitionsPart.Styles.Append(templateStyle.CloneNode(true));
- }
- }
- }
- }
Here an existing document is taken using WordprocessingDocument class finally Cloned all the styles present in existing document, similarly I want to do it using Docx DLL. How to get styles used in existing document using Docx DLL? kindly please help.