如何使用Open XML SDK 2.0生成带有文本缩进的Word文档? [英] How can I generate Word document with text indentation using Open XML SDK 2.0?

查看:229
本文介绍了如何使用Open XML SDK 2.0生成带有文本缩进的Word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   我需要使用Rich Text Editor提供的输入创建一个word文档。因此,在生成Word文档时,如何为< ul>< li>< / li>< / ul>保留标签缩进?这是通过富文本编辑器提供的。

    I need to create a word document using the input given by Rich Text Editor. So, while generating Word doc, how can I preserve tab indentation for <ul><li></li></ul> which has been given through Rich Text Editor.

仅供参考,我使用Open XML SDK2.0来生成它。那么,你们中的任何人都可以支持我吗?

FYI, I am using Open XML SDK2.0 for generating this. So, can any of you guys support me?

提前致谢。

Naresh Palvai。

Naresh Palvai.

推荐答案

嗨Naresh Palvai,

Hi Naresh Palvai,

感谢您的提问。

申请缩进 在一段文本中,您可以使用DocumentFormat.OpenXml.Wordprocessing.Indentation类,该类指定应用于当前段落的缩进属性集。例如:

To apply indentation on a piece of text, you could use the DocumentFormat.OpenXml.Wordprocessing.Indentation class, which specifies the set of indentation properties applied to the current paragraph. For example:

< w:pPr>

<w:pPr>

< w:ind w:left =" 1440"瓦特:右= QUOT; 1440"瓦特:吊= QUOT; 1080" />

<w:ind w:left="1440" w:right="1440" w:hanging="1080" />

< / w:pPr>

</w:pPr>

这组缩进属性指定应提供1440个点缩进的二十分之二本段文本边距的左侧和右侧,以及第一段中的文本应用于文本
边距的1080的二十分之二,给它一个网从文本边距缩进四分之一英寸。

This set of indentation properties specifies that a 1440 twentieths of a point indentation should be provided on both the left and the right side of the text margins for this paragraph, and that a 1080 twentieths of a point hanging indent (towards the text margin) should be applied to the text in the first paragraph, giving it a net one-quarter inch indent from the text margin.

您可以从"Open XML SDK Documentation"中找到更详细的信息。
的一部分
生产力工具
。您还可以在Word和"比较文件"中制作模板。 - > "反映代码"使用工具查看生成的示例代码,了解如何将缩进应用于段落。

You could find more detailed information from the "Open XML SDK Documentation" section of the Productivity Tool. You could also make templates in Word and "Compare Files" -> "Reflect Code" with the Tool to see the generated sample code of how to apply the indentation to a paragraph.

希望这会有所帮助。如果您有任何疑问,请告诉我。

Hope this helps. If you have any question, please let me know.

谢谢,

Lu


这篇关于如何使用Open XML SDK 2.0生成带有文本缩进的Word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆