Question Word document used style info

anil3b2

Member
Joined
Jun 19, 2009
Messages
14
Programming Experience
1-3
Hi All,

I need to go thru word document para by para and i need to display or collect paragraphs format/style name using vb .net.

Can anyone guide me to do this?

Regards
Anil
 
Add reference to the COM library 'Microsoft Word <version> Object Library' to use this code:
VB.NET:
'Imports Word = Microsoft.Office.Interop.Word

Dim App As New Word.Application
Dim path As String = IO.Path.Combine(Application.StartupPath, "test.doc")        
Dim doc As Word.Document = App.Documents.Open(CType(path, Object))

For Each para As Word.Paragraph In doc.Paragraphs
    Dim style As Word.Style = CType(para.Style, Word.Style)
    Dim name As String = style.NameLocal

Next

doc.Close()
App.Quit()
 
Back
Top