0

我现在在创建文档时遇到问题。我创建了一个包含多个 MergeField 元素的 Word docx 文档。我的文档内容保存到我的数据库中,稍后我使用 MemoryStream myStream = new MemoryStream(byte[]); 在我的代码中的其他地方检索它 文档 doc = new Document(myStream);

当我尝试使用 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]]
4

1 回答 1

0

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.

于 2011-06-27T16:50:45.390 回答