I'm having an issue right now with document creation. I've created a Word docx document containing several MergeField elements. My document content's is saved to my db, and later on I retrieve it somewhere else in my code using MemoryStream myStream = new MemoryStream(byte[]); Document doc = new Document(myStream);
When I try to access my form merge fields using doc.Range.FormFields, the list is empty. I'm wondering why because I can still see the formating of my MergeField elements when I do doc.Range.GetText();
Could you please help me figure this out. I've been struggling for some time. See below for the content of my document after I access its Range's text. I've also attached a screenshot of my content where we can see my MERGE FIELD elements' tags.
Raw Content:
PAGE \* MERGEFORMAT 1
Evaluation Only. Created with Aspose.Words. Copyright 2003-2010 Aspose Pty Ltd.
2011 Marine Liability Quote
MERGEFIELD FieldAMapped \m \* MERGEFORMAT «FieldAMapped» MERGEFIELD FieldB \* MERGEFORMAT «FieldB» MERGEFIELD FieldC \* MERGEFORMAT «FieldC» MERGEFIELD FieldDMapped \m \* MERGEFORMAT «FieldDMapped»
Assured: [[InsuredCompanyName]]
[[InsuredAddress]]
[[InsuredCity]], [[InsuredState]], [[InsuredZip]]
[[InsuredContactFirstName]] [[InsuredContactLastName]]
Coverage(s): Commercial Marine Liability
Effective: 12 Months at [[PolicyEffectiveDate]] (MM/DD/YYYY)
Deductible: $ per occurrence
Commission: [[DistributorCommission]] %
Premium: $ [[TotalGrossPremiumAmount]]
Security: Starr Indemnity & Liability Company (A.M. Best A, FSC X)
Coverage Premiums:
Coverage TypeGross Premium[[OW_REPEAT_BEGIN]] [[Premium_PremiumType]]$[[Premium_Amount]][[OW_REPEAT_END]] State Surcharge$[[TotalTaxesAmount]]Total$[[TotalGrossPremiumAmount]]
Limits:
Coverage PartCoverage TypeLimit[[OW_REPEAT_BEGIN]][[Limit_PremiumType]][[Limit_Description]]$[[Limit_Amount]][[OW_REPEAT_END]]
Conditions:[[InsuringConditions]]