简体   繁体   English

使用Open XML将RTF合并到Word文档内容控制

[英]Merge Rich Text ( HTML ) to Word Document Content Control using Open XML

I have a word template which has a content control placeholder to hold rich text data. 我有一个Word模板,它具有一个内容控制占位符来保存富文本数据。 The data comes from a sharepoint list (rich text field) and may also include tables in it. 数据来自共享点列表(富文本字段),并且其中可能还包含表。

On checking the data from sharepoint list I found it returns me a HTML formatted data. 在检查共享点列表中的数据时,我发现它返回了HTML格式的数据。 I wish to place this data in the content placeholder with proper formatting. 我希望以适当的格式将此数据放置在内容占位符中。

For example if the data returned is HTML table ( format) I want a table to be created with data populated. 例如,如果返回的数据是HTML表格(格式),则我希望使用填充的数据来创建表格。 Is there any method available to place the data in content control. 是否有任何方法可以将数据放入内容控件中。

I found that third party tool converter at http://html2openxml.codeplex.com/ which is available for conversion, however this appends data to MainDocumentPart not to content control. 我在http://html2openxml.codeplex.com/上找到了可用于转换的第三方工具转换器,但是这会将数据附加到MainDocumentPart而不是内容控件。

Please guide. 请指导。 Thanks in advance. 提前致谢。

You could try to use WordDocGenerator , which uses content controls. 您可以尝试使用WordDocGenerator ,它使用内容控件。 Then combine it with html2openxml, as discussed here . 然后用html2openxml结合起来,为讨论在这里 However, I find the formatting in some cases becomes terrible after adding the html content into your content control--one example is when inserting lists, the bullet points goes out of view when you open the document. 但是,我发现在将html内容添加到内容控件后,在某些情况下格式变得很糟糕-一个示例是在插入列表时,当您打开文档时项目符号点不可见。 I have not tried adding a whole table into a content control. 我没有尝试将整个表添加到内容控件中。

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

相关问题 如何从 Word 文档中复制富文本内容控件的内容并使用 Open XML SDK 删除控件本身 - How to copy content of Rich Text Content Control from Word document and remove the control itself using Open XML SDK Word open xml的富文本内容控件中的新行 - New Line in Rich Text Content Control of Word open xml 使用OpenXML将RTF和HTML插入RTF文本框内容控件 - Insert RTF and HTML to Rich Text Box Content Control using OpenXML 创建单词模板,并使用Open XML用代码替换内容控制文本 - Create a word template and replace content control text with code using Open XML 将Word 2010中的丰富内容控件的内容转换为html格式 - Convert contents of a rich content control in word 2010 to html format 打开XML Word文档-查找突出显示的文本 - Open XML word document - find highlighted text 如何使用open xml sdk获取word文档的所有合并字段 - How to get all merge fields of word document using open xml sdk 将多种Word文档样式合并到一个Open Xml中 - Merge multiple Word Document styles into one Open Xml 如何使用类似 json 格式的 C# open-xml SDK 从 Word 文档中获取文本? - How to get text out of Word Document using C# open-xml SDK in json like format? 如何使用开放XML SDK在word文档的页脚中查找和替换文本? - How to find and replace the text in the footer of the word document using open XML SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM