Hello I am trying to combine two documents with the code below and get an exception:
This property is only allowed for list styles.
On the last row: WordDocument.Save(FilePath);
can you help me? is it a known bug? version 4.0.2
I have attached the problematic word file I am trying to combine with a new one.
// Open the source document.
Document srcDoc = new Document(_originalFilePath);
// For a twist, let's say I want the second document to start on the same page where
// the first document ends. This is controlled by a property of the first section.
srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.Continuous;
// Combine the documents, see the function below.
AppendDoc(WordDocument, srcDoc);
// Sets the file to be not read only (sometimes the file is readonly and it is failed)
try
{
System.IO.FileInfo info = new System.IO.FileInfo(FilePath);
info.IsReadOnly = false;
}
catch { /* Eat this - just don't set to read only */ }
// Save the finished document.
WordDocument.Save(FilePath);