0

We are creating word document using openxml programatically. Everything works fine but when we protect the document also programactially using openxml for editing then contents of the document are getting affected for example the sentence نحاول اصلاح التقرير اليوم وشكرا will become اليوم وشكرا نحاول اصلاح التقرير

If the generated document is not protected then everything stays fine.

Any help would appreciated.

Thanks in advance.

The code we are using to protec the document is

        using (WordprocessingDocument wdoc = WordprocessingDocument.Open(strPath, true))
        {
            DocumentSettingsPart docSett = wdoc.MainDocumentPart.DocumentSettingsPart;
            docSett.RootElement.Append(new DocumentProtection { Edit = DocumentProtectionValues.ReadOnly });
            docSett.RootElement.Save();
        }
Verybiztalker
  • 75
  • 1
  • 7

1 Answers1

0

Somehow we managed to solve the problem by converting the normal book mark text to html and adding to the doucment using altChunk technique. This is preventing now the swapping of sentence.

<p>نحاول اصلاح التقرير اليوم وشكرا </p>

Doing so has solved our problem but still not sure why sentence was being swapped when document is protected if it is added to book mark as normal text.

Thanks

Verybiztalker
  • 75
  • 1
  • 7