简体   繁体   English

如何在仅显示属性并保留所有其他信息的文档中导出复杂元素?

[英]How to export a complex element in a doc showing just a property and keeping all other information?

I need to import and export some documents from my web app written in .net-core to docx and viceversa: the users should be able to export, modify offline, and import back.我需要将一些用 .net-core 编写的 Web 应用程序导入和导出到 docx,反之亦然:用户应该能够导出、离线修改和导入回来。 Currently I am using OpenXml-PowerTools to export.目前我正在使用 OpenXml-PowerTools 进行导出。

The problem is that there are dynamic contents that show the current value of some fields in the database so I should be able to export the document showing a face value (for instance an amount of money) and when importing back I should be able to recall the original reference (which is an object containing an expression and operations, like "sum_db_1 + sum_db_2" and info about the formatting of numbers and so on).问题是有动态内容显示数据库中某些字段的当前值,所以我应该能够导出显示面值(例如金额)的文档,并且在导入时我应该能够回忆原始参考(这是一个包含表达式和操作的对象,例如“sum_db_1 + sum_db_2”和有关数字格式的信息等)。 Of course if needed everything can be treated as a String instead of a complex object.当然,如果需要,一切都可以视为字符串而不是复杂对象。

In the original document the face value is shown (a text or an amount) while the original formula is stored like in this xml:在原始文档中显示面值(文本或金额),而原始公式存储在此 xml 中:

 <reuse-link reuse="reuse-link">
  <reuse-param name="figname" value="exp_sum_n"></reuse-param>
  <reuse-param name="format" value="MC"></reuse-param>
</reuse-link>

In short, I need the possibility to export a complex object in Word that shows the face value and keeps somewhere also the other additional fields of the original object so they can be retrieved once imported back.简而言之,我需要能够在 Word 中导出一个显示面值的复杂对象,并将原始对象的其他附加字段保存在某处,以便在导入后可以检索它们。 The possibility of editing the "complex" values is not foreseen.无法预见编辑“复杂”值的可能性。

How can I achieve this?我怎样才能做到这一点?

I tried to negotiate with customers explaining they should only edit online but they are not flexible to change their internal workflow that foresee an exchange of the document between various parties.我试图与客户协商,解释说他们应该只在线编辑,但他们不能灵活地改变他们预见到各方之间交换文件的内部工作流程。

Thank you in advance for your help.预先感谢您的帮助。

I suggest you use one or more Custom XML Parts to store whatever additional information you need.我建议您使用一个或多个自定义 XML 部件来存储您需要的任何附加信息。 You will probably need to create a naming convention that will allow you to relate elements/attributes in those Parts to the "face values" (however they may be expressed).您可能需要创建一个命名约定,允许您将这些部件中的元素/属性与“面值”相关联(无论它们如何表达)。

A Custom XML Part can store any XML (the content does have to be valid XML).自定义 XML 部件可以存储任何 XML(内容必须是有效的 XML)。 As long as you create them, and the necessary relationships, in the .docx or Flat OPC format .xml file, the Parts should survive normal use - ie the user would have to do something unusual to delete them.只要您在 .docx 或 Flat OPC 格式的 .xml 文件中创建它们以及必要的关系,这些部件就应该能够正常使用 - 即用户必须做一些不寻常的事情才能删除它们。

You could also store the information in Word document variables, but Custom XML Parts look like a better fit to your scenario.您也可以将信息存储在 Word 文档变量中,但自定义 XML 部件看起来更适合您的方案。

(Sorry, I am not yet allowed to post comments or respond to them here). (对不起,我还不能在这里发表评论或回复他们)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 所有列表都会更新,而不仅仅是一个元素 - All lists gets updated instead of just one element 在 dotnet-publish 中,属性覆盖是否会传播到所有其他引用的项目? 这能控制吗? - In dotnet-publish, do property overrides propagate to all other referenced projects? Can that be controlled? 如何获得在 Blazor 中单击的元素的 css 属性? - How can I get css property of an element which clicked in Blazor? 如何将复杂的linq映射到对象 - How to map complex linq to object 如何仅从导航属性中查询一小部分(不包括该属性中的所有数据)? - How to query only a small part from a navigation property (without including all data in that property)? 实体框架未将所有信息保存到数据库中 - Entity Framework not saving all the information into database 带有 Mongo 的 OData:System.ArgumentException:'Item' 类型上的属性 'Id' 必须是复杂属性。 (参数'propertyInfo')' - OData with Mongo: System.ArgumentException: 'The property 'Id' on type 'Item' must be a Complex property. (Parameter 'propertyInfo')' 在其他类型的基础上创建一个新类型,只需更改名称 - Create a new type based on other type, just changing the name 使用 AutoMapper,我如何 map 聚合根属性到所有目标集合项属性? - Using AutoMapper, how do I map an aggregate root property to all destination collection item properties? 如何使用 Automapper 避免 foreach 复杂结构 - How to use Automapper toavoid foreach for complex structure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM