How to use C # parsing Word (1) - get the style tag in the document

xiaoxiao2021-03-06  70

A few days ago, I wrote this code.

: Note This function is very simple in VB but is not too simple in C #, many methods

The usage difference made me pain for a long time.

Word.Document doc = null; Word.ApplicationClass app = new ApplicationClass (); Word.Style _style; string _XmlStr = ""; object missing = System.Reflection.Missing.Value; try {object FileName = Server.MapPath ( ". ") " // Test.doc "; object readonly = true; object index = true; Object index = 0; doc = app.documents.open (Ref fixenly, ref missing, ref ready, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); foreach (Word.Paragraph pa in app.ActiveDocument.Paragraphs) {_style = ( Word.style) Pa.get_Style (); this.listStyle.Items.add (_Style.NameLocal);

}}}}} Catch (exception ex) {js.showmsg (ex.Message); App.actiVedocument.Close (ref missing); gc.collect ();

转载请注明原文地址:https://www.9cbs.com/read-120280.html

New Post(0)