如何将RichTextBox内容交换为HTML

问题描述 投票:0回答:1

我想将RichTextBoxContents交换为HTML。

我用过aspose.word,但它是演示版。 ex)enter image description here

html wpf richtextbox
1个回答
0
投票

这应该指导你一个粗略的方向:

string output = "";
Foreach( line in richtextbox.text)
{
  output += $"<p style=\"color:{line.color.name};\">"
  output += line
  ouput += "</p>";
}

应该给你这样的东西:

<p style="color:red;">This is a the line content.</p>

我在手机上,如果语法有点偏离,那就怜悯吧

© www.soinside.com 2019 - 2024. All rights reserved.