我現在正在創建文檔時遇到問題。我創建了一個包含多個MergeField元素的Word docx文檔。我的文檔內容保存到我的數據庫,後來我在我的代碼中的其他地方使用 MemoryStream myStream = new MemoryStream(byte [])檢索它; Document doc = new Document(myStream);Aspose Words Document does not load myFields
當我嘗試使用doc.Range.FormFields訪問我的表單合併域時,該列表爲空。我想知道爲什麼,因爲當我執行doc.Range.GetText()時,仍然可以看到我的MergeField元素的格式化;
請你幫我解決這個問題。我一直在掙扎一段時間。訪問Range的文本後,請參閱下面的文檔內容。我還附上了我的內容的屏幕截圖,可以看到我的MERGE FIELD元素的標籤。
原始內容:
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]]