VSTO: Issue with adding text to a list item in a list in MS Word doc using C# -



VSTO: Issue with adding text to a list item in a list in MS Word doc using C# -

original list in ms word 2010 doc:

a b c d e

the code add together text "test" end of item 2 (with value b) in list:

word.application oapp = new word.application(); word.document odoc = oapp.documents.open(filename: @"c:\folder1\test1.docx"); string st = odoc.lists[1].listparagraphs[1].range.text; odoc.lists[1].listparagraphs[2].range.text = st + "test"; ((word._document)odoc).close(savechanges: word.wdsaveoptions.wdsavechanges); ((word._application)oapp).quit();

resulting list:

a a testc d e

what wanted:

a btest c d e

notice in resulting list code doing 2 things wrong: 1. replacing sec item value b , 2. adding text "test" @ origin of item value c.

c# ms-word ms-office vsto office-interop

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -