I have attached the document that has the following simple IF field code
{ IF "2" = "1" "This" "That" }
I use Aspose 9.0
for.Net and my code is
// System.Diagnostics.Debug.WriteLine("WordWriterWrapper.CreateMergedDocument; begin at: [" + DateTime.Now.ToString() + "]");
using (MemoryStream ms = new MemoryStream(draftDocument))
{
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense("Aspose.Total.lic");
Aspose.Words.Document doc = new Aspose.Words.Document(ms);
doc.Variables["DocumentClass"] = "merged";
doc.UpdateFields();
// write processedDocument to resultStream
MemoryStream resultStream = new MemoryStream();
doc.Save(resultStream, Aspose.Words.SaveFormat.Doc);
// convert processed resultStream to byte array
byte[] mergedDocument = resultStream.ToArray();
// System.Diagnostics.Debug.WriteLine("WordWriterWrapper.CreateMergedDocument; end at: [" + DateTime.Now.ToString() + "]");
// Return processed document as a byte[]
return mergedDocument;
When I open the mergedDocument, I expect to see That but I see {IF "2"="1" "This" "That"}
.
What’s going wrong ?