Aspose Words Document 无法加载我的 FormFields
我现在在创建文档时遇到问题。我创建了一个包含多个 MergeField 元素的 Word docx 文档。我的文档内容保存到我的数据库中,稍后我使用代码在其他地方检索它 MemoryStream myStream = new MemoryStream(byte[]); 文档 doc = new Document(myStream);
当我尝试使用 doc.Range.FormFields 访问表单合并字段时,列表为空。我想知道为什么,因为当我执行 doc.Range.GetText(); 时,我仍然可以看到 MergeField 元素的格式。
你能帮我解决这个问题吗?我已经挣扎了一段时间了。在访问其范围文本后,请参阅下面的文档内容。我还附上了我的内容的屏幕截图,我们可以在其中看到我的合并字段元素的标签。
原始内容:
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]]
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]]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕,在这种情况下,我们可能需要您提供一些文件和其他详细信息,以便调查该问题;在这种情况下,我们可能还需要记录问题并进行跟进。我们可以通过我们自己的支持论坛来做到这一点。
您可以通过 Aspose.Words 论坛联系我们的支持团队并详细讨论这个问题。
披露:我在 Aspose 担任开发人员传播者。
I'm afraid, in such scenarios, we might require some documents and other details from your end in order to investigate the issue; we might also need to log the issues and then follow up, in such cases. And this is something we can do via our own support forums.
You may contact our support team via Aspose.Words forum and discuss this matter in detail.
Disclosure: I work as developer evangelist at Aspose.