none
Parallel programming with word Interop RRS feed

  • Question

  • Hi,

    We have a scenario where we have to insert a bookmark in every page of the word document. we are planning to use Parallel.For to insert all the bookmarks parallely to improve performance, but looks like, some times bookmarks are inserted wrongly at places where other bookmark has to be inserted. Below is the code we are using to make it parallel.

                    Parallel.For(2, n, i =>
                    {
                        iObj = i;
                        Bookmarks.Add("Mark" + i.ToString(), aSel.GoTo(ref aWhat, ref aWhich, ref iObj, ref ourMissing));  
                    });

    Could someone please help to fix this issue.

    Thanks



    • Edited by M_RT Monday, March 4, 2019 9:04 AM
    Monday, March 4, 2019 9:04 AM