C#字符串到格式化的HTML字符串 [英] C# string to Formatted HTML string

查看:571
本文介绍了C#字符串到格式化的HTML字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可以将未格式化HTML(没有缩进,没有新行等)的C#字符串转换为格式化HTML字符串的工具?

Is there a tool out there that can turn a C# string of unformatted HTML(no indentions,no new lines,etc) into a Formatted HTML string?

我处于生成HTML字符串的情况,并将其输出到多行文本框中.现在写,它是换行的,但显示的类似于段落.我希望将其显示为格式化的HTML吗?它甚至不必是非常好的格式,但至少不显示HTML的一段.

I am in a situation where I am generating an HTML string, and I am outputting it into a multiline textbox. write now, it is wrapping, but is showing up similar to a paragraph. I would like it to be shown as formatted HTML? It wouldn't even have to be very nice formatting, but at least not show a paragraph of HTML.

我正在使用WPF,以防万一.

I am using WPF, in case that changes anything.

提前谢谢

推荐答案

这是一些将文本转换为HTML的代码,但您确实需要更好地解释格式化"的含义.

Here is some code to convert text to HTML but you'd really need to better explain what you mean by "formatted".

例如,您说您的输入没有换行符?那么应该如何格式化呢?您是否想要一些知道在哪里插入换行符,然后将输入分解为各段的内容?

For example, you said your input has no newlines? So how should that be formatted? Are you wanting something that knows where to insert newlines and then break the input up into paragraphs?

这篇关于C#字符串到格式化的HTML字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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