TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sathya
NA
96
3k
how to get Styles from existing word document by using Docx
Mar 3 2017 7:17 AM
This is the code for OpenXML
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.
scenario: I have a word Document called
Dev
, they used different styles in it. I'm going to generate new word document, where I need to add styles which are present in
Dev
. These must be done using Docx dll
Reply
Answers (
0
)
FileNotFoundException unhandled error
Difficulties with @htm helpers mvc web application